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.6.tar.gz (17.7 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.6-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for analysta-0.0.6.tar.gz
Algorithm Hash digest
SHA256 7722d2693bf27b5cc25e5d611a42bb571c2536a017a43b5fc347b7b98c51a255
MD5 8c8eb8dce659f7447b1e1f7ce8284c2d
BLAKE2b-256 bc52957049edd82db5a6c698aee7e45cf1494d286eb143c0ea0addb6cfdabce8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for analysta-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 129ee03462533d2dcce3d719f9ff9de50a72d3dc5cc08a66bc91791f35319f18
MD5 8e9d96e035230345e32963468ca9705a
BLAKE2b-256 db905fa112190efc5642738e853120139e076218f704bc981e5e6a1f12f15497

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