agentleFS
NikoxkxNikoxkx/Agent-Skills/skills/data-analytics/pandas-data-cleaner/SKILL.md

pandas-data-cleaner

Skill1 starsChanged 5 months agoApache-2.0View on GitHub

Cleans, transforms, and validates datasets using pandas. Use when preparing raw data for analysis, modeling, or export.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Remove accents, normalize unicode.

    line 54
  2. Very specific:

    Add derived columns (e.g., is_weekend, age_group).

    line 66
  3. Distinctive:

    Before/after summary statistics.

    line 74
  4. Very specific:

    Very large files: Use chunksize or Dask / Polars for out-of-core.

    line 85
  5. Distinctive:

    Run the cleaner on the raw data — no errors.

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Overview

Provides a complete, reusable pandas data cleaning pipeline for raw datasets. Covers missing value strategies (drop, fill, interpolate), duplicate detection and removal, dtype inference and safe casting, string normalization, outlier detection (IQR, Z-score, isolation forest), column renaming conventions, and a full end-to-end cleaning function template that can be dropped into notebooks or scripts.

When to Use This Skill

  • Receiving raw data from exports, APIs, or databases that needs preparation.
  • Exploratory data analysis (EDA) before modeling.
  • Building reproducible data preparation steps for ML or reporting.

Prerequisites

  • Python environment with pandas, numpy, and optionally scikit-learn for advanced outlier detection.
  • The raw dataset (CSV, Parquet, DataFrame in memory, or SQL query result).
  • Understanding of the domain (what "valid" looks like for each column).

Steps

  1. Initial inspection:
    • df.head(), df.info(), df.describe(include='all'), df.isnull().sum().
    • Identify obvious issues (mixed types, weird strings, extreme values).
  2. Missing values strategy (per column or group):
    • Drop rows/columns if <5% missing and not critical.
    • Fill with median/mean/mode for numeric.
    • Forward/backward fill or interpolate for time series.
    • "Unknown" or sentinel value for categorical.
    • Flag rows with missing critical fields.
  3. Duplicates:
    • Exact duplicates: drop_duplicates().
    • Fuzzy duplicates (same entity different spelling): use recordlinkage or simple key normalization + group.
  4. Dtype cleaning & casting:
    • Infer dtypes safely.
    • Convert dates with pd.to_datetime(errors='coerce').
    • Numeric with pd.to_numeric(errors='coerce').
    • Categorical for low-cardinality strings.
  5. String normalization:
    • .str.strip().str.lower().
    • Remove accents, normalize unicode.
    • Standardize categories (map "USA", "U.S.", "United States" → "US").
  6. Outlier detection & treatment:
    • IQR method for most numeric.
    • Z-score for near-normal distributions.
    • Domain-specific rules (negative age, price > 10x median, etc.).
    • Cap, clip, or flag rather than blindly remove.
  7. Column hygiene:
    • Rename to snake_case, consistent naming.
    • Reorder columns logically.
    • Add derived columns (e.g., is_weekend, age_group).
  8. Validation:
    • Assert expected columns, dtypes, row count range, no nulls in critical fields.
    • Great Expectations or custom checks.
  9. Output:
    • Reusable clean_data(df: pd.DataFrame) -> pd.DataFrame function.
    • Before/after summary statistics.
    • Notebook cells or script that can be run on new files.
    • Export to Parquet/CSV with metadata.

Examples

A complete cleaning pipeline for a typical customer/orders dataset (handle missing emails, normalize country codes, detect price outliers, deduplicate on customer_id + email, cast dates, add features) with before/after reports is included.

Edge Cases & Error Handling

  • Mixed types in a column: Coerce and report how many rows became NaN.
  • Very large files: Use chunksize or Dask / Polars for out-of-core.
  • Time series specific: Resample, forward fill with limits, detect gaps.

Verification

  1. Run the cleaner on the raw data — no errors.
  2. clean_df.isnull().sum() shows only expected missing values.
  3. clean_df.dtypes are correct.
  4. Spot checks: random samples look reasonable.
  5. Row count and key statistics are within expected ranges (or documented changes are explained).
  6. Re-run on a new batch of raw data produces consistent output shape.
  7. Success: The cleaned dataset is ready for analysis or modeling with documented transformations.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.