Skip to main content

input_checker


The input_checker package enables users to compare a given data frame against a benchmark data frame. The package executes that by keeping track of the key information in the benchmark data frame and cross-checking the comparison data frame against those tracked characteristics.

The package currently contains five main checks;

  • Null checker: ensures that columns with missing values in the benchmark data frame are the only columns with missing values in the comparison data frame
  • Dtype checker: ensures that columns in the comparison data frame are of the same data type as in the benchmark data frame
  • Categorical value checker: ensures that categorical columns in the comparison data frame only contain values that exist in the benchmark data frame
  • Numerical checker: ensures that the values of the numerical columns in the comparison data frame lie within the minimum and maximum range of the numerical columns in the benchmark data frame
  • Datetime checker: ensures that the values of datetime columns in the comparison data frame lie beyond the minimum date (optionally maximum) of datetime columns in the benchmark data frame

The package has multiple usage areas including but not limited to ensuring that data points sent to the model in live environment matches key characteristics of the data the model was initially trained on.

Here is a simple example of using input_checker to compare training data to test data;

import pandas as pd
from sklearn.datasets import load_wine
from sklearn.model_selection import train_test_split

import input_checker
from input_checker.checker import InputChecker

# load and prepare sklearn wine dataset
wine = load_wine()

df_wine = pd.DataFrame(wine['data'], columns = wine['feature_names'])
df_wine['target'] = wine['target']

# split into train/test sets
df_train, df_test = train_test_split(df_wine, test_size=0.2)

# define numerical columns 
# please note; the original wine dataset only has numerical fields
# please refer to the example notebook under the examples folder for 
# using input_checker with different dtypes and missing values
numerical_columns = ['alcohol', 'malic_acid', 'ash', 'alcalinity_of_ash', 'magnesium',
       'total_phenols', 'flavanoids', 'nonflavanoid_phenols',
       'proanthocyanins', 'color_intensity', 'hue',
       'od280/od315_of_diluted_wines', 'proline']

# define input_checker
checker = InputChecker(columns=numerical_columns,
                       numerical_columns=numerical_columns) 

# fitting input_checker
checker.fit(df_train)

# compare test data frame to the training data frame
df_test_checked = checker.transform(df_test)

Installation

input_checker can be installed from PyPI simply with;

pip install input_checker

Documentation

Documentation for input_checker can be found on readthedocs.

Examples

To help get started there is an example notebook in the examples folder that shows how to use input_checker.

Build and test

The test framework we are using for this project is pytest, to run the tests follow the steps below.

First clone the repo and move to the root directory;

git clone https://github.com/lvgig/input_checker.git
cd input_checker

Then install input_checker in editable mode;

pip install -e . -r requirements-dev.txt

Then run the tests simply with pytest

pytest

Contribute

input_checker is under active development, we're super excited if you're interested in contributing! See the CONTRIBUTING.md for the full details of our working practices.

For bugs and feature requests please open an issue.

Metadata

Release files for input-checker 0.3.9

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

Source distribution (sdist)

Source distribution for input-checker 0.3.9
File Size Uploaded Provenance
input_checker-0.3.9.tar.gz 24.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for input-checker 0.3.9
File Interpreter ABI Platform
input_checker-0.3.9-py3-none-any.whl Python 3 none any Details

Total release size: 48.8 kB

Release files / input_checker-0.3.9.tar.gz

Download URL input_checker-0.3.9.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
958cd4e50412704ac7f8e62f3be808b438504e702ddd6b0a4d123d8715c22589
BLAKE2b-256 checksum
How to use checksums
117684d7a4c8986906567b08f3a9f915167d257fba063c472085d8da2985d17a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / input_checker-0.3.9-py3-none-any.whl

Download URL input_checker-0.3.9-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2a6c2b7bf90543534d71bd39e67effc973bbe449ebc72c35264379ca1697c9a
BLAKE2b-256 checksum
How to use checksums
fa28048e632219c2d0eed47ba75f0b5829d1be343973b6093bcb4430b34f8011
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Security for input-checker 0.3.9

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.

Release history Release notifications | RSS feed

This release

0.3.9 This release

2 release files No provenance

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