pandas_validate
A python package used for validating pandas dataframes.
⚙️ Installation
python -m pip install pandas_validate
🚀 Usage
# Imports
import pandas as pd
from pandas_validate import Schema
from pandas_validate.columns import IntColumn, TextColumn
# Define your Schema
class MySchema(Schema):
IntField = IntColumn(min_value=3, max_value=10)
TextField = TextColumn(min_length=3, max_length=5, pattern="^[a-c]+$")
# Get your DataFrame
df = pd.DataFrame({
'IntField': [1, 6, 11, 7],
'TextField': ['ab', 'abcd', 'ccbbaa', 'ccb'],
'UnknownField': [1, 2, 3, 4]
})
# Validate your DataFrame
validated_df, exceptions = MySchema.validate(df)
Results
>>> print(validated_df)
IntField TextField
0 NaN None
1 6.0 None
2 NaN None
3 7.0 ccb
>>> print(exceptions)
column row value error error_details
0 IntField 0.0 1 Column validation failed The value 1 < 3
1 IntField 2.0 11 Column validation failed The value 11 < 10
2 TextField 0.0 ab Column validation failed The value ab is too short
3 TextField 1.0 abcd Column validation failed The value abcd does not match the regular expr...
4 TextField 2.0 ccbbaa Column validation failed The value ccbbaa is too long
5 UnknownField NaN None Unknown Column The column "UnknownField" is not in the Schema
Code Contributors
This project exists thanks to all the people who contribute. [Contribute].
🤝 Contributing
Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.
Check the contributing guide.
Author
👤 Larry Green
- Github: @larrygreen3
Show your support
Please ⭐️ this repository if this project helped you!
📝 License
Copyright © 2023 Larry Green.
This project is MIT licensed.
Release files for pandas-validate 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pandas-validate-1.0.2.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pandas_validate-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.7 kB
Release files / pandas-validate-1.0.2.tar.gz
| Download URL | pandas-validate-1.0.2.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7dd62e5dbac978b82ca30d9e7ab9082e2b347278f5e91a1b4bf71a1f5ba21e07
|
|
BLAKE2b-256 checksum How to use checksums |
e061a34c9c0c5431ade3543e486a9f75eed0b2eab144f2c390fbab5cc3e6b6aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / pandas_validate-1.0.2-py3-none-any.whl
| Download URL | pandas_validate-1.0.2-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60b0f66634281fe76713544bb5bee1f3a723ca1a7dab6959aa235b16f2e2168b
|
|
BLAKE2b-256 checksum How to use checksums |
5a8204ddce4f4c07ef4ffe2a728bf5794f63e04fc97aaf4a587f32c66c6d94b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|