DataFrame Toolkit for Analysts
Project description
analysta 🖇️
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file analysta-0.0.5.tar.gz.
File metadata
- Download URL: analysta-0.0.5.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2e3fdc16319f93268c3fad91f9704f3d04cbfffba1e936598cf4fa7d91d16d4
|
|
| MD5 |
6be51c45506d6326d3587dac5c87c2ea
|
|
| BLAKE2b-256 |
8ed21a43f8db64ffeed2389c4b644828e99ffcfe56dd173d9af39fcd893ea097
|
File details
Details for the file analysta-0.0.5-py3-none-any.whl.
File metadata
- Download URL: analysta-0.0.5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48617ddb00c849ed415eb2ac6befeb9622a757fc756db2297585a129a35a575c
|
|
| MD5 |
ffde25f1cb1cd6cbd4c8374665a11446
|
|
| BLAKE2b-256 |
e841c8e476d0feb8acfc66be405d17df1ea5fc0a7bf836d452db56d2afaaa9fe
|