Skip to content
Back to skills

Pandas Data Cleaning

ASecurity

Cleans messy DataFrames with typed columns, explicit null handling and assertions. Use it when raw CSV or Excel data needs to become trustworthy.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 15, 2026
ai-agentsrustgo

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill pandas-data-cleaning --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pandas Data Cleaning?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pandas Data Cleaning
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/workspace-templates-pandas-data-cleaning/badge)](https://www.skillsdirectory.com/skills/workspace-templates-pandas-data-cleaning)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pandas-data-cleaning
description: Cleans messy DataFrames with typed columns, explicit null handling and assertions. Use it when raw CSV or Excel data needs to become trustworthy.
---

# Pandas data cleaning

Every change to the data must be explicit, counted and checked.

## Steps

1. Load with intent: pass `dtype=` for IDs and codes (keep them as strings so leading zeros survive), `parse_dates=` for known dates, and `na_values=` for the file's own null markers such as "N/A" or "-".
2. Look before you fix: `df.info()`, `df.isna().sum()`, `df.nunique()`, and `df.describe(include="all")`. Print the number of rows at the start.
3. Normalize text columns: `.str.strip()`, consistent case, and one canonical spelling map for categories.
4. Convert types explicitly with `pd.to_numeric(errors="coerce")` and `pd.to_datetime(errors="coerce")`, then count what became null and inspect those rows before deciding.
5. Decide each null on purpose: drop, fill with a stated default, or keep as `pd.NA` with a nullable dtype (`Int64`, `string`, `boolean`).
6. Deduplicate on a named key with `drop_duplicates(subset=[...], keep=...)` and say which row wins and why.
7. Finish with assertions: unique key, no nulls in required columns, values inside allowed ranges, expected dtypes.

## Rules

- Never use `inplace=True` or chained assignment. Return a new frame from a pure function.
- Never drop rows silently. Log how many were removed per step.
- Do not guess a date format; use an explicit `format=`.

## Report

Rows in and out, per step counts, columns whose type changed, and any rows set aside for a human to review.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.