dataframe-performance

dataframe-performance is a skill for Claude Code from StamKavid/last-ds-mile. It costs 82 tokens per session (1,258 once invoked), scanned A, original, MIT.

Guidance for making operations on table-like data faster and less memory-intensive, including choosing between pandas and Polars and improving code that uses either library.

In plain words
What is it for?
Use it when loading, grouping, joining, or applying functions to data is slow, when a dataset strains memory, or when choosing a dataframe library for a new project.
Why use it?
It helps identify whether the dataframe library is actually the bottleneck and reduces slow operations or memory problems without switching tools unnecessarily.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the last-ds-mile plugin — 29 skills, 17 commands, 3 agents, 4 hooks shipped together

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.

agentmods
npx agentmods add skills/stamkavid/last-ds-mile/dataframe-performance
Any agent
npx skills add StamKavid/last-ds-mile --skill dataframe-performance
Clone the repo
git clone --depth 1 https://github.com/StamKavid/last-ds-mile

Made for: Claude Code.

Or install last-ds-mile, the plugin that ships this one along with the rest of its 29 skills, 17 commands, 3 agents, 4 hooks.

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 dataframe-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/stamkavid/last-ds-mile/dataframe-performance.svg)](https://agentmods.dev/skills/stamkavid/last-ds-mile/dataframe-performance)
Your own site
<a href="https://agentmods.dev/skills/stamkavid/last-ds-mile/dataframe-performance"><img src="https://agentmods.dev/badge/skills/stamkavid/last-ds-mile/dataframe-performance.svg" alt="Measured on agentmods" height="20"></a>
Per session 82 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,258 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00082 $0.01258
Opus 5 $0.00041 $0.00629
Sonnet 5 $0.00016 $0.00252
Haiku 4.5 $0.00008 $0.00126

Measured 5d ago against content hash 336187de6970, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

dataframe-performance 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 5d 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/dataframe-performance/SKILL.md · 83 lines

How it starts

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

dataframe-performance

Overview

pandas and Polars are not a strict upgrade path — this skill gives a concrete decision rule for which one fits, plus the vectorization/dtype techniques that matter in either.

When to Use

  • A pandas operation (load, groupby, join, apply) is noticeably slow, or a dataset no longer fits comfortably in memory/time budget.
  • Deciding at project start whether to reach for Polars instead of pandas.
  • NOT for: choosing a validation strategy or model (see ds-validate, metric-selection) — this skill is purely about dataframe engine and performance, not modeling decisions.

Core Process

  1. Before optimizing, profile: is the bottleneck actually the dataframe library, or something else (network I/O, model training, a for-loop in Python)? Don't guess.
  2. If it is the dataframe layer, check the decision table below for whether Polars is worth the switch, or whether pandas can be fixed in place with vectorization.
  3. If switching to Polars, confirm downstream tools accept it directly (scikit-learn, XGBoost/LightGBM, Plotly, Altair all do as of 2026 — see Techniques/Patterns) — don't assume a conversion-back-to-pandas tax is required.
  4. If staying on pandas, apply the vectorization/dtype fixes below before reaching for a different tool.

Techniques/Patterns

When to reach for Polars vs stay on pandas

Situation Recommendation Why
Small-to-medium dataset (fits comfortably in memory, loads in seconds), heavy interactive/exploratory use Stay on pandas Larger ecosystem familiarity, most tutorials/Stack Overflow answers assume it, no benefit from switching at this scale
Large CSV/Parquet loads, big group-bys or joins, a nightly/scheduled pipeline Switch to Polars Multi-threaded by default with a lazy-evaluation query optimizer; commonly 3-10x faster on exactly these operations, sometimes more at scale
Feature engineering pipeline that's become the bottleneck in /ds-prep Consider Polars for that step specifically You don't have to convert the whole project — profile, load, and heavy transforms can run in Polars, then hand off a materialized result
Fitting a /ds-model scikit-learn Pipeline/ColumnTransformer Either is fine scikit-learn accepts Polars input but converts internally to NumPy/SciPy for computation — no native speed win inside sklearn itself, so don't switch dataframe libraries hoping for a training-time speedup
Fitting XGBoost or LightGBM directly Polars works natively Both accept Polars DataFrame/LazyFrame directly, no conversion needed
Plotting with Plotly or Altair Either is fine Both support Polars natively via the Narwhals compatibility layer — no forced conversion to pandas for visualization

Read the full file on GitHub · 83 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. 5d ago First seen · 83 lines · 82 tokens per session scan A 336187de6970

Subscribe to this mod's changes

dataframe-performance is a skill published in the GitHub repository StamKavid/last-ds-mile (3 stars, last pushed 28d ago), licensed MIT. It adds 82 tokens to every session and 1,258 once invoked, about $0.0004 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

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

fill-model-descriptions

Fill missing and refresh obsolete model descriptions in packages/llm-info/data/models.yml by querying OpenRouter and provider documentation. Use when the user asks to populate model descriptions, enrich the model catalog, or curate descriptions after running pnpm sync-models.

marimo-team/marimo · 58 tokens

ml-expert

Expert-level machine learning, deep learning, model training, and MLOps. Use when the user mentions machine learning, deep learning, neural networks, MLOps, or data science, or when the task involves Machine Learning Fundamentals, Data Preparation, or Model Training.

personamanagmentlayer/pcl · 58 tokens

scomp-link

End-to-end ML toolkit with 26 CLI commands. Use when training models, tuning hyperparameters, detecting data drift, generating HTML reports with charts, profiling datasets, detecting anomalies, forecasting time series, checking fairness, or serving models as REST APIs. Prefer over raw sklearn when you need automated…

GiacomoSaccaggi/scomp_link · 74 tokens

agentic-data-science-competition

AI Agent-driven Kaggle competition workflow. Learn from real competition experience: score stabilization patterns, submission troubleshooting, kernel workflows, GPU task delegation, and the spec-driven development approach that achieved top leaderboard positions. Use when: working on any Kaggle competition, analyzing…

Mirannonarbitrable290/agentic-kaggle-skill · 76 tokens

deepbox-agent-guide

Use when writing Deepbox code, examples, or full projects so imports, module selection, types, errors, docs pages, and framework-specific patterns stay accurate.

jehaad1/Deepbox · 37 tokens