Skip to main content

Tabular Data Validator

This is a Python library that allows you to validate tabular datasets based on specific rules defined in a Validation Contract.

When you have a dataset with a large number of rows, checking manually if all records are correct is not practical. This validator allows you to check them automatically. You only need to define which rules each column should follow.

Features

  • empty dataset validation
  • required columns validation
  • missing values validation
  • expected data type validation
  • unique values validation
  • allowed values validation
  • sort order validation
  • value range validation
  • validation issues reported as errors and warnings
  • Validation Contract for defining dataset rules
  • CLI generator for creating contract.py and validate.py

Getting started

Create validation files for your CSV dataset by providing the path to the file:

tabular-data-validator path/to/dataset.csv

The generator creates a new folder named after the dataset and copies the original CSV file into it. The original dataset remains unchanged in its current location.

dataset/
├── dataset.csv
├── contract.py
└── validate.py

All column names from the dataset are automatically added to contract.py.

Open the generated folder and define the validation rules for each column in contract.py. Then run:

python validate.py

The validator will display all errors and warnings found in the dataset.

If needed, the CSV delimiter and decimal separator can be provided manually:

tabular-data-validator dataset.csv --delimiter ";" --decimal ","

Validation Contract

Validation rules are defined in contract.py using ValidationContract and ColumnRules.

Dataset-level rules are defined in ValidationContract.

Currently available:

  • require_non_empty

Available column rules:

Rule Description
required Requires the column to exist
no_missing_values Does not allow missing values
data_type Defines the expected data type
only_unique_values Requires values to be unique
allowed_values Defines allowed values
specific_sort_order Defines the expected sort order
minimum_value Defines the minimum allowed value
maximum_value Defines the maximum allowed value

Conversion checks are currently supported for:

  • int
  • float
  • datetime

If a value has a different type, the validator checks whether it can be safely converted to the expected type. The validator does not modify the original dataset.

For complete usage examples, see the examples directory.

Examples

The repository contains examples using different types of datasets:

  • ECB exchange rate data - real financial time-series data
  • Temperature data - synthetic data used to demonstrate validation rules
  • Heart Failure Clinical Records - external medical data from the UCI Machine Learning Repository

These examples show how the same validation system can be used with different types of tabular datasets.

License

This project is licensed under the MIT License.

Download files

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

Source Distribution

tabular_data_validator-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tabular_data_validator-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file tabular_data_validator-0.1.0.tar.gz.

File metadata

  • Download URL: tabular_data_validator-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tabular_data_validator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51a9722258d18074bfbd8defd4386fecc514222ed090892d122cbba9fe7d4025
MD5 45c6898deb68e81291b0c1982c437bf0
BLAKE2b-256 b1f9761f970b959d1e4f8cd3f73132fc7f3b04d9aea67b14bf568e8b658b17f6

See more details on using hashes here.

File details

Details for the file tabular_data_validator-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tabular_data_validator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tabular_data_validator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f5b89784fa1197ec57b99712fdf204203f40bf4af9137898e224ade541ed58d
MD5 8d19a3e56afdbbab0f761ed7a7e2659f
BLAKE2b-256 853af463d60696c723dbc45739c92ed7c4adc834392f2674080c07ed629b023e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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