A smart data-profiling library for pandas DataFrames — basic and advanced column metadata, heterogeneity detection, null-pattern analysis, and categorical correlation discovery.
Project description
summarystatpkg
A smart data-profiling library for pandas DataFrames. Goes well beyond .describe() — it detects datetime columns, analyses null patterns, flags heterogeneous columns, clusters mixed-format values, and discovers categorical correlations automatically.
Installation
pip install summarystatpkg
Quick Start
import pandas as pd
from summarystatpkg import csv_metadata, advanced_csv_metadata
df = pd.read_csv("your_file.csv")
# ── Basic profiling ──────────────────────────────────────────
basic = csv_metadata(df)
# Returns a list of dicts, one per column
# ── Advanced profiling ───────────────────────────────────────
advanced = advanced_csv_metadata(df)
# Returns:
# advanced["columnMetadata"] → per-column analysis
# advanced["possibleCorrelation"] → detected column relationships
What Each Function Does
csv_metadata(df)
Basic column scanner. For every column it returns:
| Field | Description |
|---|---|
name |
Column name |
data_type |
pandas dtype |
notnullpercentage |
% of non-null rows |
uniquepercentage |
% unique values |
top_5_value_counts |
Most frequent values |
mean_value_count |
Mean (numeric) or mean frequency (object) |
std_dev_value_count |
Std dev of above |
max_value / min_value |
Range (numeric columns only) |
isdatetime |
Whether the column looks like a datetime |
advanced_csv_metadata(df)
Smart profiler. Runs on up to 2 000 rows for performance. Per column it runs:
Null pattern analysis — are non-null values clustered or periodic?
{
"has_clusters": True,
"periodic_pattern": False,
"common_gap": None
}
Heterogeneity detection — entropy + frequency variance score (0–1). Scores above 0.5 trigger structural clustering.
Structural clustering — for heterogeneous columns, values are profiled on 12 character-level features and clustered with KMeans. Returns stratified sample values per cluster:
{
"cluster_0": {
"sample_values": ["john@example.com", "alice@corp.io"],
"dominant_features": ["len_11_20", "has_at"]
},
"cluster_1": {
"sample_values": ["N/A", "unknown"],
"dominant_features": ["len_0_10"]
}
}
Correlation detection — scans all categorical column pairs for
one-to-one or many-to-one relationships:
{
"country_code->country_name": "one-to-one",
"store_id->region": "many-to-one"
}
Individual utility functions
from summarystatpkg import (
is_datetime_column, # series → bool
null_clustering_analysis, # (df, col) → dict
entropy_based_detection, # (df, col) → float [0–1]
feature_based_clustering, # (df, col) → dict
detect_correlations_optimized, # df → dict
)
Example Output
import pandas as pd
from summarystatpkg import advanced_csv_metadata
df = pd.DataFrame({
"email": ["a@b.com", "c@d.org", None, "e@f.net"],
"country": ["US", "UK", "US", "DE"],
"country_name": ["United States", "United Kingdom", "United States", "Germany"],
"score": [10, 20, 30, 40],
})
result = advanced_csv_metadata(df)
print(result["possibleCorrelation"])
# {'country->country_name': 'one-to-one'}
Requirements
- Python ≥ 3.9
- pandas ≥ 1.5
- numpy ≥ 1.23
- scikit-learn ≥ 1.2
License
MIT
Project details
Release history Release notifications | RSS feed
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 summarystatpkg-0.1.0.tar.gz.
File metadata
- Download URL: summarystatpkg-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ebf49df17907a92a895da4c9c37f2f026d48d1d9cfe4e334b2a77f8814ac02e
|
|
| MD5 |
671a14751500081a6312f978e68ad939
|
|
| BLAKE2b-256 |
be8fe1be9a1689ddce0dd64aa078503b1f549ae09b766b151a7457d996967081
|
File details
Details for the file summarystatpkg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: summarystatpkg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bef2ef009f92a39e25977dc2e4af3573f9d440b9803a8c701b6482c383f4ca21
|
|
| MD5 |
36ebb76dcbf97d566b3a132ea0a0ea18
|
|
| BLAKE2b-256 |
b9cbe095eb6a942b3b2e098a9ab611b8a29ccdc95226221cf749eaca2881de87
|