Skip to main content

DataFrame Toolkit for Analysts

Project description

analysta 🖇️

PyPI - Version PyPI - Python Version

A Python library for comparing pandas DataFrames using primary keys, tolerances, and audit-friendly diffs.** Easily detect mismatches, missing rows, and cell-level changes between two datasets.


🧾 Table of Contents

🚀 Installation

pip install analysta

Python 3.8 or higher is required.

For a concise import, you can alias the package:

import analysta as nl

⚡ Quick Example

import analysta as nl
import pandas as pd

# Row 1 exists only in df1, row 4 only in df2
# Row 3 exists in both but has a different price
df1 = pd.DataFrame({"id": [1, 2, 3], "price": [100, 200, 300]})
df2 = pd.DataFrame({"id": [2, 3, 4], "price": [200, 250, 400]})

delta = nl.Delta(df1, df2, keys="id")
print(delta.unmatched_a)         # → id=1
print(delta.unmatched_b)         # → id=4
print(delta.changed("price"))    # → id=3
print(nl.find_duplicates(df1, column="id"))  # Duplicates by column

📚 More Examples

Tolerant numeric diffs

import analysta as nl
import pandas as pd

df_a = pd.DataFrame({"id": [1, 2], "value": [100.0, 200.005]})
df_b = pd.DataFrame({"id": [1, 2], "value": [100.0, 200.0]})

delta = nl.Delta(df_a, df_b, keys="id", abs_tol=0.01)
print(delta.changed("value"))  # diff 0.005 < 0.01 → empty

delta = nl.Delta(df_a, df_b, keys="id", abs_tol=0.001)
print(delta.changed("value"))  # diff 0.005 > 0.001 → id=2

Counting duplicates

df = pd.DataFrame({"id": [1, 1, 2, 2, 2]})
print(nl.find_duplicates(df, column="id", counts=True))

Trimming whitespace

df = pd.DataFrame({"id": ["1"], "name": [" Alice "]})
clean = nl.trim_whitespace(df)
print(clean)

✨ Features

  • Key-based row comparison: "A not in B" and vice versa
  • Tolerant numeric diffs (absolute & relative)
  • Highlight changed columns
  • Built for analysts, not just engineers
  • Automatic trimming of leading/trailing whitespace
  • Detect duplicate rows with optional counts
  • CLI and HTML reporting coming soon

📄 License

analysta is distributed under the terms of the MIT license.

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

analysta-0.0.4.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

analysta-0.0.4-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file analysta-0.0.4.tar.gz.

File metadata

  • Download URL: analysta-0.0.4.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for analysta-0.0.4.tar.gz
Algorithm Hash digest
SHA256 b1e9c2b846208e1533bc3b9f04577228f0f3fd46705811852d35978a3d30ca65
MD5 f575402cac841e7f3f3da5f68d2577cb
BLAKE2b-256 ad1a580407ab3519e2cb2c1c1e796b70a014b9bad2809802d6495dd6ea5014f8

See more details on using hashes here.

File details

Details for the file analysta-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: analysta-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for analysta-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6081b694f159a40612bc184bb0af118cc77cbf2542f08756689e004ed18b738d
MD5 bec33c04551872b24662e44ebc83e4c0
BLAKE2b-256 ff5fde96425afef0b32fbfd384bf69c40b18f6d36983707ee85776f48dd23695

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page