param087/agent-ml-skills/pandas-patterns
Claude Code and agent skill by param087/agent-ml-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when writing or reviewing pandas code. Covers idiomatic, vectorized, memory-efficient patterns; avoiding SettingWithCopyWarning, chained indexing, and slow apply loops.
Install
npx vskill@latest install param087/agent-ml-skills/pandas-patternsSKILL.md
The same SKILL.md was published earlier as param087/agent-ml-skills/pandas-patterns.
Pandas Patterns
Overview
Most pandas pain comes from three things: chained indexing, row-wise apply, and ignoring dtypes/memory. This skill encodes the idioms that keep pandas correct and fast.
When to use
- Writing data-wrangling code.
- Code is slow, leaks memory, or throws
SettingWithCopyWarning. - Reviewing someone's pandas for correctness.
Core rules
- Assign with `.loc`, never chained.
``python df.loc[df["age"] > 30, "segment"] = "senior" # correct # df[df["age"] > 30]["segment"] = "senior" # WRONG: SettingWithCopyWarning, no-op risk ``
- Vectorize instead of `apply(axis=1)`. Row-wise apply is a Python loop.
``python df["bmi"] = df["weight"] / df["height"] ** 2 # fast # df.apply(lambda r: r.weight / r.height**2, axis=1) # 100x slower ``
- Use `np.select` / `np.where` for conditional columns.
``python import numpy as np df["tier"] = np.select( [df.spend > 1000, df.spend > 100], ["gold", "silver"], default="bronze", ) ``
- Downcast dtypes to cut memory:
categoryfor low-cardinality strings,int32/float32where safe.
``python df["country"] = df["country"].astype("category") ``
- Prefer `merge` over loops for joins, and validate join cardinality:
``python df = orders.merge(users, on="user_id", how="left", validate="m:1") ``
Performance toolkit
df.groupby(..., observed=True).agg(...)—observed=Trueavoids exploding categorical combinations.pd.eval/df.query()for large boolean filters.- Read big files in chunks (
chunksize=) or switch to Polars/DuckDB when pandas is the bottleneck. df.pipe(fn)to compose transformations without intermediate variables.
Method chaining (readable + copy-safe)
Pitfalls
- `inplace=True` rarely saves memory and breaks chaining — avoid it.
- Iterating with `iterrows` — almost always replaceable with vectorization or
itertuples. - Floating-point group keys — round or use integer/category keys.
- Silent dtype upcasts (int → float when NaN appears) — use nullable
Int64if you must keep integers.
Hand-off
Clean, vectorized transformations that downstream skills (feature-engineering, model-evaluation) can run quickly on full datasets.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/pandas-patterns/SKILL.md
Popularity
- Repository stars
- 11
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/param087/agent-ml-skills/pandas-patterns)