pandas-patterns

pandas-patterns is a skill for Claude Code, Codex from param087/agent-ml-skills. It costs 38 tokens per session (721 once invoked), scanned A, original, MIT.

A set of guidelines for writing and reviewing pandas code, where pandas is a Python tool for working with tables of data. It focuses on correct assignments, fast column operations, joins, and memory use.

In plain words
What is it for?
Use it when cleaning, transforming, joining, reviewing, or optimising pandas DataFrames.
Why use it?
It helps avoid silent data errors, slow row-by-row code, chained-indexing problems, and unnecessary memory consumption.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when cleaning, transforming, joining, reviewing, or optimising pandas DataFrames.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/param087/agent-ml-skills/pandas-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add param087/agent-ml-skills --skill pandas-patterns
Clone the repo
git clone --depth 1 https://github.com/param087/agent-ml-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pandas-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/param087/agent-ml-skills/pandas-patterns.svg)](https://agentmods.dev/skills/param087/agent-ml-skills/pandas-patterns)
Your own site
<a href="https://agentmods.dev/skills/param087/agent-ml-skills/pandas-patterns"><img src="https://agentmods.dev/badge/skills/param087/agent-ml-skills/pandas-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 721 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.00721
Opus 5 $0.00019 $0.00360
Sonnet 5 $0.00008 $0.00144
Haiku 4.5 $0.00004 $0.00072

Measured 6d ago against content hash e6e3059764f2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

pandas-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/pandas-patterns/SKILL.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

  1. Assign with .loc, never chained.
    df.loc[df["age"] > 30, "segment"] = "senior"   # correct
    # df[df["age"] > 30]["segment"] = "senior"      # WRONG: SettingWithCopyWarning, no-op risk
    
  2. Vectorize instead of apply(axis=1). Row-wise apply is a Python loop.
    df["bmi"] = df["weight"] / df["height"] ** 2          # fast
    # df.apply(lambda r: r.weight / r.height**2, axis=1)  # 100x slower
    
  3. Use np.select / np.where for conditional columns.
    import numpy as np
    df["tier"] = np.select(
        [df.spend > 1000, df.spend > 100],
        ["gold", "silver"],
        default="bronze",
    )
    
  4. Downcast dtypes to cut memory: category for low-cardinality strings, int32/float32 where safe.
    df["country"] = df["country"].astype("category")
    
  5. Prefer merge over loops for joins, and validate join cardinality:
    df = orders.merge(users, on="user_id", how="left", validate="m:1")
    

Performance toolkit

  • df.groupby(..., observed=True).agg(...)observed=True avoids 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)

result = (
    df
    .query("status == 'active'")
    .assign(revenue=lambda d: d.qty * d.price)
    .groupby("region", observed=True)
    .agg(total=("revenue", "sum"))
    .reset_index()
)

Read the full file on GitHub · 78 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 78 lines · 38 tokens per session scan A e6e3059764f2

Subscribe to this mod's changes

pandas-patterns is a skill published in the GitHub repository param087/agent-ml-skills (9 stars, last pushed 3mo ago), licensed MIT. It adds 38 tokens to every session and 721 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

fastapi-templates

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

wshobson/agents · 37 tokens

marimo-pair

Work inside the user's live marimo notebook from the code editor: run Python in the same kernel the user does, inspect live notebook state, and commit durable notebook changes through code mode. Use whenever you create, analyze, or improve the user's marimo notebook.

marimo-team/marimo · 57 tokens

python-guidelines

This skill should be used when writing, reviewing, or refactoring Python code. Covers code integration, idiomatic patterns, docstring formatting, anti-abstraction rules, and software engineering basics.

fcakyon/claude-codex-settings · 42 tokens

manimgl-best-practices

Trigger when: (1) User mentions "manimgl" or "ManimGL" or "3b1b manim", (2) Code contains from manimlib import , (3) User runs manimgl CLI commands, (4) Working with InteractiveScene, self.frame, self.embed(), ShowCreation(), or ManimGL-specific patterns. Best practices for ManimGL (Grant Sanderson's 3Blue1Brown…

calesthio/OpenMontage · 167 tokens

cnsplots

Create, revise, and troubleshoot publication-ready scientific plots in Python with cnsplots, including distribution, regression, heatmap, genomics, survival, set, flow, and multi-panel figures. Use when a user asks for cnsplots code, Cell/Nature/Science-style visualization, precise pixel-sized figures, statistical…

faridrashidi/cnsplots · 79 tokens