Skip to main content

Dataset summary and anomaly analysis library

Project description

dataexaminer

A Python library that examines datasets and produces per-column summaries including data type, record count, missing values, and anomaly detection.

Installation

pip install dataexaminer

For Excel file support:

pip install dataexaminer[excel]

Quick Start

from dataexaminer import examine

# From a CSV or Excel file
result = examine("data.csv")             # returns a dict
examine("data.csv", output="console")   # prints a table

# From a pandas DataFrame
import pandas as pd
df = pd.read_csv("data.csv")
examine(df, output="console")

Example Output

DataExaminer Report — sales_data.csv
Examined: 2026-03-22 14:05:00   Rows: 5,000   Cols: 4

Column      Dtype           Kind         Records  Missing  Miss%   Anomalies  Detail
----------  --------------  -----------  -------  -------  ------  ---------  -------------------------------------------------
revenue     float64         numeric      5,000    23       0.5%    12         12 IQR outliers (fence: 105.0 – 9842.0)
category    object          categorical  5,000    41       0.8%    8          8 values in rare categories (<1%): ['UNKN', 'N/a']
order_date  datetime64[us]  datetime     5,000    5        0.1%    3          3 gap(s) >5.0× median (median: 1d, largest: 47d)
notes       object          categorical  5,000    5,000    100.0%  0          —

What Gets Detected

Column Type Anomaly Method Description
Numeric IQR fence (Tukey) Values outside Q1 ± 1.5 × IQR
Categorical Rare category Values with frequency below 1% of non-null rows
Datetime Gap detection Intervals exceeding 5× the median gap; dates outside 1900–2100

Programmatic Usage

from dataexaminer import DataExaminer
from dataexaminer.formatters import ConsoleFormatter, DictFormatter

examiner = DataExaminer()
report = examiner.examine(df)

# report.columns is a list of ColumnSummary objects
for col in report.columns:
    print(col.column_name, col.missing_count, col.anomaly_count)

Working with the Report Object

report = examiner.examine(df)

print(report.row_count)       # total rows
print(report.col_count)       # total columns
print(report.examined_at)     # datetime of analysis

for col in report.columns:
    print(col.column_name)    # column name
    print(col.dtype)          # pandas dtype string
    print(col.kind)           # "numeric" | "categorical" | "datetime" | "boolean"
    print(col.record_count)   # total rows
    print(col.missing_count)  # number of null values
    print(col.missing_pct)    # percentage of null values
    print(col.anomaly_count)  # number of anomalies detected
    print(col.anomaly_detail) # human-readable description

Dict Output

result = examine("data.csv")  # default output="dict"
print(result["row_count"])
print(result["columns"][0]["anomaly_detail"])

Custom Detectors

The library is designed to be extended. Implement AnomalyDetector and pass it in:

from dataexaminer import DataExaminer
from dataexaminer.detectors import AnomalyDetector, IQRAnomalyDetector
import pandas as pd

class ZeroInflationDetector(AnomalyDetector):
    """Flags columns where more than 50% of non-null values are zero."""

    def supports(self, series: pd.Series) -> bool:
        return pd.api.types.is_numeric_dtype(series)

    def detect(self, series: pd.Series) -> tuple[int, str]:
        clean = series.dropna()
        if clean.empty:
            return 0, "—"
        zeros = (clean == 0).sum()
        pct = zeros / len(clean) * 100
        if pct > 50:
            return int(zeros), f"{zeros} zero values ({pct:.1f}%)"
        return 0, "—"

examiner = DataExaminer(detectors=[IQRAnomalyDetector(), ZeroInflationDetector()])
report = examiner.examine(df)

Tuning Built-in Detectors

from dataexaminer.detectors import IQRAnomalyDetector, RareCategoryDetector, DatetimeAnomalyDetector

examiner = DataExaminer(detectors=[
    IQRAnomalyDetector(iqr_multiplier=3.0),       # less sensitive to outliers
    RareCategoryDetector(threshold_pct=5.0),       # flag categories below 5%
    DatetimeAnomalyDetector(gap_multiplier=10.0),  # only flag very large gaps
])

Supported File Formats

Format Requires
CSV (.csv) pandas (included)
Excel (.xlsx, .xls) pip install dataexaminer[excel]

Requirements

  • Python 3.10+
  • pandas 2.0+

License

MIT © Aeron Zentner

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

dataexaminer-0.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

dataexaminer-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file dataexaminer-0.1.0.tar.gz.

File metadata

  • Download URL: dataexaminer-0.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for dataexaminer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d8a174bc1dbc24ae74eaad759ed406d41ab1919a7262e1802e694b08b8c81b2e
MD5 52e7dcdbb3a8c65f7f6877c4ec85c512
BLAKE2b-256 43ee827b131c25bdb91f03ff709f393b8fcabf3a84fd0ed554398147abc65f52

See more details on using hashes here.

File details

Details for the file dataexaminer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dataexaminer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for dataexaminer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16a5790bf298f8c793f366349faeaafbcfaa5c682e02f1e7dc615d4668e816e1
MD5 d96a1f3b2d86907fdd236cbcb8d849be
BLAKE2b-256 6dce28f82fbb3041add5cc96b4fb077659941ca83e2506e3890cf2f710e6ca99

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