Agent skill
python-pandas-best-practices
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/python-pandas-best-practices
SKILL.md
---name: pandas-best-practices description: Standards for efficient, readable, and performant data manipulation using Python's Pandas library. license: MIT metadata: author: AI Group version: "1.0.0" category: Software_Engineering compatibility:
- system: Python 3.9+
- system: Pandas 2.0+ allowed-tools:
- read_file
- replace
- write_file
keywords:
- python-pandas-best-practices
- automation
- biomedical measurable_outcome: execute task with >95% success rate. ---"
Pandas Best Practices
This skill provides guidelines for working with tabular data in Python. It focuses on vectorization, memory management, and method chaining to write "Modern Pandas" code.
When to Use This Skill
- Data Cleaning: Preprocessing clinical or genomic datasets.
- Analysis: Performing aggregations, merges, or statistical summaries.
- Performance: Optimizing slow-running scripts that process large CSVs/DataFrames.
Core Capabilities
- Vectorization: Replacing
forloops with vectorized array operations. - Method Chaining: Writing readable, fluent data transformation pipelines.
- Memory Optimization: Using appropriate dtypes (Categoricals, Nullable Ints) to reduce RAM usage.
- Modern Indexing: Using
.locand.iloccorrectly; avoidingSettingWithCopyWarning.
Workflow
- Inspect Data: Check
df.info()anddf.head(). - Define Pipeline: Plan transformations (filter -> group -> aggregate).
- Implement Chain: Write the logic as a chain of methods.
- Optimize: Check for loops or
applycalls that can be vectorized.
Example Usage
User: "Calculate the mean age by patient group, but exclude patients with missing IDs."
Agent Action:
- Reads
references/rules.md. - Generates:
python
result = ( df .dropna(subset=['patient_id']) .groupby('patient_group')['age'] .mean() .reset_index() )
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?