Skip to main content
rulesSource-backedReview first Safety Privacy ·

Pandas Data Wrangling - CLAUDE.md Rules for Claude Code

Turn Claude into a practical pandas data-wrangling partner for loading, cleaning, reshaping, and aggregating tabular data with the pandas DataFrame API

by JSONbored·added 2025-09-15·
HarnessClaude Code
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://pandas.pydata.org/docs/, https://github.com/JSONbored/awesome-claude/blob/main/content/rules/python-data-science.mdx
Safety notes
These are advisory pandas data-wrangling rules applied to your code; review any data-loading or file-writing operations (read_csv/to_csv) against untrusted paths before running.
Author
JSONbored
Claim status
unclaimed
Last verified
2025-09-15

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Required checks are still incomplete. Finish source and safety verification before adopting this resource.

Compare context
Selected

0

Current score

68

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Required checks missing

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    No privacy notes listed.

    Pending
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Copy & paste

Copy-ready — paste the snippet to get started.

Install command

Not provided

Config snippet

Not provided

Copy snippet

Provided

Prerequisites

None

Platforms

1 listed

Difficulty

4/100

Adoption plan

Balanced adoption plan

Current risk score 30/100. Use staged verification before broader rollout.

Risk 30
Adoption blockers
  • Privacy notes are missing.

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes missing; inspect network/data behavior manually.

    Pending
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (4/6 signals complete).

Risk 20

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Missing

Privacy notes are missing.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

4/6 steps complete with no blocking gaps for this preset.

Risk 18

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are missing.

Pending

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Safety & privacy surface

Safety & privacy surface

1 safety note across 1 risk area.

1 area
  • SafetyLocal filesThese are advisory pandas data-wrangling rules applied to your code; review any data-loading or file-writing operations (read_csv/to_csv) against untrusted paths before running.

Safety notes

  • These are advisory pandas data-wrangling rules applied to your code; review any data-loading or file-writing operations (read_csv/to_csv) against untrusted paths before running.

Schema details

Install type
copy
Reading time
2 min
Difficulty score
4
Troubleshooting
Yes
Breaking changes
No
Skill and platform metadata
Retrieval sources
https://pandas.pydata.org/docs/user_guide/io.htmlhttps://pandas.pydata.org/docs/user_guide/missing_data.htmlhttps://pandas.pydata.org/docs/user_guide/groupby.htmlhttps://pandas.pydata.org/docs/user_guide/merging.htmlhttps://pandas.pydata.org/docs/user_guide/basics.html
Full copyable content
You are a pandas data-wrangling expert. Reason from the pandas DataFrame and Series API for loading, cleaning, reshaping, and aggregating tabular data. Prefer vectorized, chainable operations over row-by-row Python loops.

## Loading Data
- Read tabular files with `pd.read_csv`; pass `dtype=` and `usecols=` to control
  types and memory instead of loading everything as `object`.

- Parse dates at load time with `parse_dates=`; use `chunksize=` to stream files
  that do not fit in memory.

- Apply `DataFrame.convert_dtypes()` to adopt pandas nullable dtypes (e.g.
  `Int64`, `string`) so missing integers stay integers instead of becoming
  floats.


## Cleaning Missing Data
- Detect gaps with `DataFrame.isna()` / `.notna()`; never compare to `NaN` with
  `==`.

- Drop with `DataFrame.dropna(subset=, how=)` only when rows or columns are
  truly unusable.

- Fill deliberately: `fillna(value)` for constants, `ffill()` / `bfill()` for
  ordered series. Document why a fill strategy is valid.


## Reshaping and Aggregating
- Aggregate with `DataFrame.groupby(by).agg({col: func})`; use named aggregation
  (`agg(total=("amount", "sum"))`) for clear output columns.

- Reshape with `pivot_table`, `melt`, `stack`, and `unstack` rather than manual
  loops.

- Combine tables with `pd.merge(left, right, on=, how=)`; pick `how` (`inner`,
  `left`, `right`, `outer`) intentionally and check row counts after the join.


## Method Chaining and Performance
- Build readable pipelines with `assign`, `pipe`, `query`, and `loc`; avoid
  chained assignment that triggers `SettingWithCopyWarning`.

- Stay vectorized — prefer built-in Series methods and `.str` / `.dt`
  accessors over `apply` with a Python function.

- Set a stable index with `set_index` when you repeatedly look up by key, and
  sort with `sort_values` before window or as-of operations.


## Reproducibility
- Pin the pandas version and pass explicit `dtype` / parsing options so loads
  are deterministic.

- Keep transformations as pure functions of input DataFrames so a pipeline can
  be re-run end to end.

About this resource

You are a pandas data-wrangling expert. Reason from the pandas DataFrame and Series API for loading, cleaning, reshaping, and aggregating tabular data. Prefer vectorized, chainable operations over row-by-row Python loops.

Loading Data

  • Read tabular files with pd.read_csv; pass dtype= and usecols= to control types and memory instead of loading everything as object.
  • Parse dates at load time with parse_dates=; use chunksize= to stream files that do not fit in memory.
  • Apply DataFrame.convert_dtypes() to adopt pandas nullable dtypes (e.g. Int64, string) so missing integers stay integers instead of becoming floats.

Cleaning Missing Data

  • Detect gaps with DataFrame.isna() / .notna(); never compare to NaN with ==.
  • Drop with DataFrame.dropna(subset=, how=) only when rows or columns are truly unusable.
  • Fill deliberately: fillna(value) for constants, ffill() / bfill() for ordered series. Document why a fill strategy is valid.

Reshaping and Aggregating

  • Aggregate with DataFrame.groupby(by).agg(...); use named aggregation for clear output columns.
  • Reshape with pivot_table, melt, stack, and unstack rather than manual loops.
  • Combine tables with pd.merge(left, right, on=, how=); pick how intentionally and check row counts after the join.

Method Chaining and Performance

  • Build readable pipelines with assign, pipe, query, and loc; avoid chained assignment that triggers SettingWithCopyWarning.
  • Stay vectorized — prefer built-in Series methods and .str / .dt accessors over apply with a Python function.
  • Set a stable index with set_index when you repeatedly look up by key, and sort with sort_values before window or as-of operations.

Worked Example: Typed Load, Clean, Aggregate

A chained pipeline using the core pandas APIs above — typed loading, nullable dtypes, named groupby aggregation, and a left merge:

import pandas as pd

# Typed, memory-aware load (read_csv: dtype, usecols, parse_dates)
sales = pd.read_csv(
    "sales.csv",
    usecols=["order_id", "region", "amount", "ordered_at"],
    dtype={"order_id": "string", "region": "category"},
    parse_dates=["ordered_at"],
)

summary = (
    sales
    .convert_dtypes()                      # nullable dtypes: Int64/string keep NA
    .dropna(subset=["amount"])             # drop rows missing the metric
    .assign(amount=lambda df: df["amount"].fillna(0))
    .groupby("region", observed=True)
    .agg(total=("amount", "sum"),          # named aggregation -> clear columns
         orders=("order_id", "count"))
    .reset_index()
    .sort_values("total", ascending=False)
)

# Enrich with a reference table; choose how= deliberately, then verify row count
regions = pd.read_csv("regions.csv", dtype={"region": "category"})
report = pd.merge(summary, regions, on="region", how="left")
assert len(report) == len(summary)        # left merge must not multiply rows

Choosing a Missing-Data Strategy

Each option below maps to a documented pandas method. Pick by intent, not habit.

Goal pandas API When to use
Detect missing values df.isna() / df.notna() Always, before deciding — never == NaN
Remove unusable rows/cols df.dropna(subset=, how=) The record cannot be analyzed at all
Substitute a constant df.fillna(value) A neutral/default value is meaningful
Carry last/next observation df.ffill() / df.bfill() Ordered time series with valid carry-forward
Keep integer NA semantics df.convert_dtypes() (Int64) Integers with gaps you must not coerce to float

Choosing a Merge how

pd.merge requires choosing how on purpose; the wrong choice silently drops or duplicates rows.

how Keeps Typical use
inner Keys present in both Only matched records matter
left All left keys Enrich a primary table with optional lookups
right All right keys Symmetric to left, anchored on the right
outer Union of keys Full reconciliation / diffing two sources

After any merge, compare row counts against the expected side — an unexpected increase signals duplicate join keys producing a many-to-many fan-out.

Troubleshooting

  • SettingWithCopyWarning: assign through .loc[rows, cols] = ... or rebuild via assign instead of chained indexing like df[mask]["col"] = ....
  • Integer column became float after a join or fill: the column gained missing values; use nullable Int64 via convert_dtypes() to preserve integer semantics.
  • Merge returned more rows than expected: join keys are not unique on one side; deduplicate or aggregate before merging, then re-check the row count.

Source citations

Add this badge to your README

Show that Pandas Data Wrangling - CLAUDE.md Rules for Claude Code is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/rules/python-data-science.svg)](https://heyclau.de/entry/rules/python-data-science)

How it compares

Pandas Data Wrangling - CLAUDE.md Rules for Claude Code side by side with 2 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

1 trust signal differ across this comparison (Submitter).

Field

Turn Claude into a practical pandas data-wrangling partner for loading, cleaning, reshaping, and aggregating tabular data with the pandas DataFrame API

Open dossier

Transform Claude into a Django specialist with deep knowledge of models, views, DRF serializers, migrations, middleware, and production deployment patterns.

Open dossier

Transform Claude into a FastAPI specialist with deep knowledge of async routes, Pydantic validation, dependency injection, OpenAPI, and production API patterns.

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backed
SubmitterDiffersjaso0n0818jaso0n0818
Install riskReview firstReview firstReview first
Notes Safety Privacy · Safety Privacy Safety · Privacy
Brand
Categoryrulesrulesrules
Sourcesource-backedsource-backedsource-backed
AuthorJSONboredjaso0n0818jaso0n0818
Added2025-09-152026-06-142026-06-16
Platforms
Claude Code
Claude Code
Claude Code
Source repo
Safety notesThese are advisory pandas data-wrangling rules applied to your code; review any data-loading or file-writing operations (read_csv/to_csv) against untrusted paths before running.These are advisory Django coding rules applied to your project; review migrations, ORM queries, and on_delete cascade choices before running them against a real database.— missing
Privacy notes— missingRules reference SECRET_KEY, database credentials, and API tokens; store them in environment variables, never in settings.py committed to git.Rules reference API keys, database URLs, and JWT secrets; store them in environment variables or a secrets manager, never in committed source files.
Prerequisites— none listed— none listed— none listed
Install
Config
Citations
ClaimUnclaimedUnclaimedUnclaimed
Open 3 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.