Skip to main content

danda

Automatically prepare pandas DataFrames for analysis. Danda automatically:

  • removes empty rows
  • removes empty columns
  • trims whitespace
  • detects dates
  • detects booleans
  • detects categorical columns
  • optimizes memory
  • generates a cleaning report

A library that aims to be a drop-in replacement for pd.read_csv() and automatically:

  • detects column types
  • converts low-cardinality strings to category
  • parses dates
  • optimizes integer/float dtypes
  • trims whitespace
  • standardizes missing values ("", "NA", "N/A", "null", etc.)
  • removes empty rows and columns
  • optionally generates a cleaning report
import danda as dg

df = dg.read_csv("sales.csv")
df = dg.read_excel("sales.xlsx")
df = dg.read_parquet("sales.parquet")

Installation

pip install danda

Usage

import pandas as pd
import danda

df = pd.read_csv("employees.csv")

clean_df = df.dg.clean()

What happens automatically

  • Remove empty rows
  • Remove empty columns
  • Strip whitespace [" John ", " John", "John "] -> John
  • Normalize missing values ["", " ", "N/A", "NULL", "None", "-"] -> Nan
  • Detect dates 2025-01-01->datetime64[ns]
  • Detect booleans [Yes , No , TRUE , FALSE ,0, 1] -> bool
  • Detect categorical columns unique values < 20 or unique ratio < 15%
  • Optimize integer types int64 -> int8
  • Detect IDs: do not do these [CustomerID , ZipCode , PostalCode, Phone]
  • Memory optimization: Show users the improvement. Memory before : 95 MB, Memory after : 21 MB, Reduction : 77.9%
  • Cleaning report:

Features

  • Validation: WARNING Column Age: 12 invalid values , converted to NaN
  • Profiling: Rows 145,000 Columns 24 Missing 3.2% Duplicates 512 Memory 18 MB Categorical 7 Numeric 10 Datetime 3
  • suggestions: Suggestions CustomerID Looks like an ID column. Convert to string? [Y/n]
  • Plugin system
dg.read_csv(
    "sales.csv",
    plugins=[
        dg.TrimWhitespace(),
        dg.ParseDates(),
        dg.RemoveDuplicates(),
        dg.NormalizeMissing(),
    ],
)
  • Pandas accessor
import pandas as pd
import dataforge

df = pd.read_csv("sales.csv")

df.dg.clean()

df.dg.profile()

df.dg.optimize()

df.dg.report()

Normalize missing values

Release files for danda 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for danda 0.1.2
File Size Uploaded
danda-0.1.2.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for danda 0.1.2
File Interpreter ABI Platform
danda-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / danda-0.1.2.tar.gz

Download URL danda-0.1.2.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bf61d43325c453b06a69a7ded7aff9dc37aa2e42cdc21e3f34d152a49fd59fb4
BLAKE2b-256 checksum
How to use checksums
f616b2160090ef7cf8429ae708d26a087ca823c964213550a4eed7072d7397af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release files / danda-0.1.2-py3-none-any.whl

Download URL danda-0.1.2-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f608d7af9774b942b50599dc3d1ec4f288e80ca44f93f139e5f13794c49e914
BLAKE2b-256 checksum
How to use checksums
b0357f0589d20d6ad3319c91fe7d855f54a3d0a06bdf48ba6928bd7cfea24d86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page