Pandas Pro

Performs pandas DataFrame operations for data analysis, manipulation, and transformation.

Development / Data & MLdevelopmentdata-ml
by AgentVoltv1.0.0Published 1y ago1 install
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

PromptMerge two dataframes on customer id but I keep getting duplicates.
Beforegeneric AI agent
Duplicate rows after a merge usually come from the join keys not being unique. Common causes:

- One or both dataframes have duplicate keys
- A many-to-many relationship between the tables
- Not specifying the join type

I'd check whether customer_id is unique in each dataframe using .duplicated() or .nunique(). If one side has duplicates, you'll get a row for each combination. You might need to deduplicate first or aggregate.

Can you share the shape of your dataframes?
Afterwith Pandas Pro
Duplicates after a merge are almost always a many-to-many key. Diagnose
before you merge — pandas even has a switch to make it fail loudly.

STEP 1 — CONFIRM WHICH SIDE
  left['customer_id'].duplicated().sum()
  right['customer_id'].duplicated().sum()
The side with a nonzero count is the culprit. Often it's the right
(e.g. one customer, many orders), which turns a 1-to-1 into a fan-out.

STEP 2 — LET PANDAS CATCH IT FOR YOU
  df.merge(right, on='customer_id', validate='one_to_one')
validate raises if the relationship isn't what you claim. Use
'one_to_many' / 'many_to_one' to assert the real shape — this turns a
silent duplicate bug into a loud error at merge time.

STEP 3 — FIX BY INTENT
  You want one row per customer, right has many → aggregate right first:
    right.groupby('customer_id').agg(total=('amount','sum')).reset_index()
    then merge. One-to-one, no fan-out.
  You genuinely want the fan-out (one row per order) → the "duplicates"
  are correct; the bug is downstream expecting uniqueness.

THE TRAP
Blindly .drop_duplicates() after the merge hides the real problem and
can drop legitimately distinct rows. Fix the join shape, don't paper
over it.

Share both dataframes' shapes and what one output row should represent,
and I'll write the exact merge.

About this skill


name: pandas-pro description: Use when Performs pandas DataFrame operations for data analysis, manipulation, and transformation.

Pandas Pro

Performs pandas DataFrame operations for data analysis, manipulation, and transformation. Use when working with pandas DataFrames, data cleaning, aggregation, merging, or time series analysis. Invoke for data manipulation tasks such as joining DataFrames on multiple keys, pivoting tables, resampling time series, handling NaN values with interpolation or forward-fill, groupby aggregations, type conversion, or performance optimization of large datasets.

What you get

  • Public GitHub repo
  • the skills/pandas-pro folder with SKILL.md and references.

Customize your output

  • Fork the repo and extend the skill's reference files for your own stack conventions.

Example output

Activates on a matching request (e.g. building or reviewing Pandas Pro code) and can chain with other skills in the pack.

Best for

Full-stack developers and engineering teams using Claude Code.

SKILL.md preview

SKILL.md
---
name: pandas-pro
description: Use when working with pandas DataFrames for cleaning, aggregation, merging, pivoting, or time series analysis, especially on datasets large enough that a naive approach gets slow.
version: 1.0.0
category: Development / Data & ML
author: AgentVolt
license: proprietary
tags:
  - development
  - data-ml
---

# Pandas Pro

Performs pandas DataFrame operations, cleaning, transformation, aggregation, and merging, for data analysis tasks, choosing techniques that stay correct and performant as data grows.

## When to use

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →