Skip to main content

pandas DataFrame validation library

Project description

# Pandas DataFrame Validator

`pd-validator` is a pandas wrapper library for validating DataFrames against a user-defined schema.

```
>>> import pandas as pd
>>> from pd_validator import Schema
>>> from pd_validator import Report

>>> df = pd.read_csv('data.csv')
>>> df
col_1 col_2
A B
1 BC
2 D
NaN A

>>> rules = {'col_1': {'dtype': int,
'length': 1,
'range': [0,1],
'required': True,
'codes': False,
'regex': False},
'col_2': {'dtype': str,
'length': 1,
'range': False,
'required': False,
'codes': ['A', 'B', 'C'],
'regex': False}
}

>>> schema = Schema(rules=rules)

>>> report = Report(df=df, schema=schema())
>>> report()
col_1 col_2 inval_line inval_col inval_val err_msg
1 BC 2 col_2 BC Invalid length: 1 char max
1 BC 2 col_2 BC Invalid code: ['A', 'B', 'C'] required
2 D 3 col_2 D Invalid code: ['A', 'B', 'C'] required
A B 1 col_1 A Invalid dtype: int required
A B 1 col_1 A Invalid range: [0, 1] required
2 D 3 col_1 2 Invalid range: [0, 1] required
NaN A 4 col_1 NaN Missing value: col_1 required

```

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pd_validator-1.0.0-py3.5.egg (13.6 kB view details)

Uploaded Source

pd_validator-1.0.0-py2.7.egg (13.1 kB view details)

Uploaded Source

File details

Details for the file pd_validator-1.0.0-py3.5.egg.

File metadata

File hashes

Hashes for pd_validator-1.0.0-py3.5.egg
Algorithm Hash digest
SHA256 abbce9bef7dee5d2b935e3c8db764cd2312649d9d1f35a790c7f539de0ed5310
MD5 e488283b0bee030a6be99894b150c3b6
BLAKE2b-256 24738ae127b12247bdd41fe7da1d519ad649b6f56f23e33f20252a33377729d4

See more details on using hashes here.

File details

Details for the file pd_validator-1.0.0-py2.7.egg.

File metadata

File hashes

Hashes for pd_validator-1.0.0-py2.7.egg
Algorithm Hash digest
SHA256 3227429530368f5fd9a63906f22038c60f0a68bddc6567338187f78e19fc2a64
MD5 693c2e753ff56cd720b994756afc9bc6
BLAKE2b-256 6e8d910e6c34cce792e4a3c7b84bd8e341eae4e1cef0715e41e015c82c01220b

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