Skip to main content

A dataframe auditor that extracts descriptive statistics from dataframe columns

Project description

still in an early development stage and undergoing significant changes regularly

dataframe-auditor

Build Status Coverage Status

A dataframe auditor that computes a number characteristics of the data.

Summary

Installation

Testing

Usage

Contributions

Summary

Data profiling is important in data analysis and analytics, as well as in determining characteristics of data pipelines. This repository aims to provide a means to extract a selection of attributes from data.

It is currently focused on processing pandas dataframes, but this functionality is being extended to spark dataframes too.

Given a pandas dataframe, the extracted values are (where object and category types are mapped to string, and all numerical types to numeric):

Type Measure
String & Numeric Percentage null
String Distinct counts
Most frequent categories
Numeric Mean
Standard deviation
Variance
Min value
Max value
Range
Kurtosis
Skewness
Kullback-Liebler divergence
Mean absolute deviation
Median
Interquartile range
Percentage zero values
Percentage nan values

Naturally, many of these characteristics are not independent of one another, but some may be excluded as suits the application.

The result of auditing a dataframe using this library is that a dictionary of these measures is returned for each column in the dataframe. For example, if a dataframe consists of a single column, named trivial, where all values are 1, then

  [{
   "attr":  "trivial",
   "type": "NUMERIC",
   "median": 1.0,
   "variance": 0.0,
   "std": 0.0,
   "max": 1,
   "min": 1,
   "mad": 0.0,
   "p_zeros": 0.0,
   "kurtosis": 0,
   "skewness": 0,
   "iqr": 0.0,
   "range": 0,
   "p_nan": 0.0,
   "mean": 1.0
   }]

For a dataframe with columns ["trivial", "non-trivial"], a list of dictionaries is returned:

  [{
    "attr":  "trivial"
    },
   {
    "attr": "non-trivial"
   }]

Installation

  • Dependencies are contained in requirements.txt:

    pip install -r requirements.txt
    
  • Alternatively, if you wish to install directly from github, you may use:

    pip install git+https://github.com/jackdotwa/dataframe-auditor.git
    

Testing

  • Unittests may be run via:
  python -m unittest discover tests
  • Code coverage may be determined via:
  coverage run -m unittest discover tests && coverage report 

Usage

Many examples of using this package is:

import pandas as pd
import dfauditor
numeric_data = {
      'x': [50, 50, -10, 0, 0, 5, 15, -3, None, 0],
      'y': [0.00001, 256.128, None, 16.32, 2048, -3.1415926535, 111, 2.4, 4.8, 0.0],
      'trivial': [1]*10
}
numeric_df = pd.DataFrame(numeric_data)
result_dict = dfauditor.audit_dataframe(numeric_df, nr_processes=3)

Contributions

Pull requests are always welcome.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dfauditor-0.0.3.linux-x86_64.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

dfauditor-0.0.3-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file dfauditor-0.0.3.linux-x86_64.tar.gz.

File metadata

  • Download URL: dfauditor-0.0.3.linux-x86_64.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for dfauditor-0.0.3.linux-x86_64.tar.gz
Algorithm Hash digest
SHA256 46d2f5a9874445526dc9dafbae57001f9e9cf96775a473fa9a54dfb58bb63bd6
MD5 f78059455a0c5edbce28a9880e737db6
BLAKE2b-256 658e988ddd0d0f3d2cb334bc41f2d2b1074381cbc4d9692052a5cd063366e062

See more details on using hashes here.

File details

Details for the file dfauditor-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: dfauditor-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for dfauditor-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 867ac854a24f1ec05f69a7ad92a00e83efb2753c8385f07fb766bbd73179d1fe
MD5 7c75d5c30f7aa1b6ed2aa38f72974234
BLAKE2b-256 1079a76456e04d42279fe0ec860633957a749e9898dd295a07c05365f733d2ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page