Skip to content
Back to skills

Python Pandas Best Practices

ASecurity

--> --- name: 'pandas-best-practices' description: 'Standards for efficient, readable, and performant data manipulation using Python''s Pandas library.' measurable_outcome: Execute skill workflow successfully with valid output within 15 minutes. allowed-tools: - read_file - run_shell_command - write_file --- 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.

  • 7 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
datapythongoshellperformance

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mdbabumiamssm/AI-Agentic-Skills-by-Dr.-Mia --skill Python_Pandas_Best_Practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Pandas Best Practices?

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

Security grade badge for Python Pandas Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mdbabumiamssm-python-pandas-best-practices-ai-agentic-skills-by-dr-mia/badge)](https://www.skillsdirectory.com/skills/mdbabumiamssm-python-pandas-best-practices-ai-agentic-skills-by-dr-mia)

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
<!--
# COPYRIGHT NOTICE
# This file is part of the "Universal AI Agentic Skills" project.
# Copyright (c) 2026 MD BABU MIA, PhD <md.babu.mia@mssm.edu>
# All Rights Reserved.
#
# This code is proprietary and confidential.
# Unauthorized copying of this file, via any medium is strictly prohibited.
#
# Provenance: Authenticated by MD BABU MIA

-->

---
name: 'pandas-best-practices'
description: 'Standards for efficient, readable, and performant data manipulation using Python''s Pandas library.'
measurable_outcome: Execute skill workflow successfully with valid output within 15 minutes.
allowed-tools:
  - read_file
  - run_shell_command
  - write_file
---


# 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

1.  **Vectorization**: Replacing `for` loops with vectorized array operations.
2.  **Method Chaining**: Writing readable, fluent data transformation pipelines.
3.  **Memory Optimization**: Using appropriate dtypes (Categoricals, Nullable Ints) to reduce RAM usage.
4.  **Modern Indexing**: Using `.loc` and `.iloc` correctly; avoiding `SettingWithCopyWarning`.

## Workflow

1.  **Inspect Data**: Check `df.info()` and `df.head()`.
2.  **Define Pipeline**: Plan transformations (filter -> group -> aggregate).
3.  **Implement Chain**: Write the logic as a chain of methods.
4.  **Optimize**: Check for loops or `apply` calls that can be vectorized.

## Example Usage

**User**: "Calculate the mean age by patient group, but exclude patients with missing IDs."

**Agent Action**:
1.  Reads `references/rules.md`.
2.  Generates:
    ```python
    result = (
        df
        .dropna(subset=['patient_id'])
        .groupby('patient_group')['age']
        .mean()
        .reset_index()
    )
    ```


<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->

Files in this skill

  • SKILL.md2.2 KB
  • references/rules.md2.2 KB

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 data →

Comments

Loading comments…

Newsletter

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