Skip to main content

Simplify table comparisons.

Project description

TabularDelta

CI Documentation pypi-version python-version

TabularDelta helps to automate and simplify the often tedious and manual process of comparing relational data.

The so-called TabularDelta protocol defines a representation of the differences between two tables. "Comparators" are used to generate such a representation from two table objects. The exchangeability of the comparators allows for varying table input formats like SQL tables or Pandas DataFrames. "Formatters" allow to present the differences in different output formats depending on the desired usecase. The flexibility in the output format allows to find small deviations in largely similar tables or provide an overview of more structural changes.

Usage example

This snippet will report the differences of two CSV files. You can execute it directly in test_docs_examples.py.

import pandas as pd
from tabulardelta import PandasComparator, DetailedTextFormatter

df_old = pd.read_csv("week24.csv", index_col=[0, 1])
df_new = pd.read_csv("week25.csv", index_col=[0, 1])

delta = PandasComparator().compare(df_old, df_new)
print(DetailedTextFormatter().format(delta))

To compare two tables, first select a comparator that supports the table format. Now select any formatter that best suits your use case to obtain a visualization of the result.

To find more examples and get started, please visit the documentation.

Development

This project is managed by pixi. You can install the package in development mode using:

git clone https://github.com/quantco/tabulardelta
cd tabulardelta

pixi run pre-commit-install
pixi run postinstall

Testing

  • Make sure docker is installed
  • Make sure ODBC Driver 17 for SQL Server is installed
  • Run pixi run test

Setting up the MsSql docker container may take a while, but it will be cached for future runs as long as you keep it running.

Project details


Download files

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

Source Distribution

tabulardelta-1.0.2.tar.gz (394.9 kB view details)

Uploaded Source

Built Distribution

tabulardelta-1.0.2-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file tabulardelta-1.0.2.tar.gz.

File metadata

  • Download URL: tabulardelta-1.0.2.tar.gz
  • Upload date:
  • Size: 394.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tabulardelta-1.0.2.tar.gz
Algorithm Hash digest
SHA256 78909b821fa43521f76ceb78a1bab901fa8626f0f11b1e086afdec4fb847414f
MD5 fabdcd4c84b055eb70127c1c202dff41
BLAKE2b-256 8ea35a9c1420f55debb7b28d180fc46d15492feb9fc016b7eb2afe3d0d9f74b7

See more details on using hashes here.

File details

Details for the file tabulardelta-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: tabulardelta-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 34.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for tabulardelta-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b76bf2d0f9cb0757836a070f5f559e8d226447b9e00ffade0bf55db828b669d8
MD5 f6e5f167f73f742acea637dbca85ca4a
BLAKE2b-256 7b205ee14ef9ca8cd01c57094dd4b373e20615e806942df6296b9ef8035185eb

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