Skip to main content

Pandas Checks

PyPI - Python Version

Banner image for Pandas Checks

Pandas Checks adds .check methods to Pandas so you can inspect method chains without cutting them up.

As Fleetwood Mac says, you would never break the chain.

import pandas_checks

iris_processed = (
    iris
    .dropna()
    .check.assert_positive(subset=["petal_length", "sepal_length"]) # 🐼🩺 Validate assumptions
    .check.hist('petal_length') # 🐼🩺 Plot the distribution of a column after cleaning

    .query("species=='setosa'")
    .check.head(3)  # 🐼🩺 Display the first few rows after more cleaning
    .check.write("iris_processed.parquet") # 🐼🩺 Export the interim data, with type inferred from name
)
Sample output

The .check methods didn't modify how iris data got processed. That's the difference between .head() and .check.head().

Table of Contents

💡 See the docs for details and configuration options.

Installation

# With uv
uv add pandas-checks

# Or with pip
pip install pandas-checks

.check methods

Here's what's in the doctor's bag.

Assertions

General:

  • .check.assert_data() - Check that data passes an arbitrary condition, expressed as a lambda function - DataFrame | Series

Type assertions:

Value assertions:

Describe data

Disable Pandas Checks

These methods can disable Pandas Checks methods, temporarily or permanently.

  • .check.disable_checks() - Don't run checks. By default, still runs assertions. - DataFrame | Series
  • .check.enable_checks() - Run checks again. - DataFrame | Series

Export interim files

  • .check.write() - Export the current data, inferring file format from the name - DataFrame | Series

Time your code

  • .check.print_time_elapsed(start_time) - Print the execution time since you called start_time = pdc.start_timer() - DataFrame | Series

💡 Tip: You can use this stopwatch anywhere in your Python code.

from pandas_checks import print_elapsed_time, start_timer

start_time = start_timer()
...
print_elapsed_time(start_time)

Visualize data

Giving feedback and contributing

If you run into trouble or have questions, I'd love to know. Please open an issue.

Contributions are appreciated! Please see more details.

License

Pandas Checks is licensed under the BSD-3 License.

🐼🩺

Metadata

Release files for pandas-checks 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pandas-checks 2.1.0
File Size Uploaded Provenance Actions
pandas_checks-2.1.0.tar.gz 33.0 kB Without provenance Details for pandas_checks-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pandas-checks 2.1.0
File Interpreter ABI Platform Actions
pandas_checks-2.1.0-py3-none-any.whl Python 3 none any Details for pandas_checks-2.1.0-py3-none-any.whl

Total release size: 68.1 kB

Release files / pandas_checks-2.1.0.tar.gz

Download URL pandas_checks-2.1.0.tar.gz
Size 33.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e7c28ec0b6989856f36c6b757e138fac444473a65a90d1ea2175670745dd7a42
BLAKE2b-256 checksum
How to use checksums
e82242dcd6470e8d36123c1008b616a5424d986ae943c0fc8732c42ad6ba7ef6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pandas_checks-2.1.0-py3-none-any.whl

Download URL pandas_checks-2.1.0-py3-none-any.whl
Size 35.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70ed147aa135e5aef6f4d38524e8da0b552a9a73a6ec7fc0a71beac538808d3d
BLAKE2b-256 checksum
How to use checksums
d165f709ad2fd34226af277218740473125363953d69ef05568ff4cc130f4f95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pandas-checks 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page