agentleFS
georgekhananaevgeorgekhananaev/claude-skills-vault/.claude/skills/data-wrangler/SKILL.md

data-wrangler

Skill28 starsChanged 6 months agoMITView on GitHub

Production-grade tabular data manipulation using pandas & openpyxl. This skill should be used when editing, creating, filtering, sorting, merging, pivoting, deduplicating, validating, or transforming CSV, Excel (xlsx/xls), JSON, Parquet, or TSV files. Supports 18 operations via CLI scripts, advanced Excel formatting (multi-sheet, freeze, auto-filter, validation, styling), and file-converter integration for format pipelines.

  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All operations follow: python3 scripts/data_wrangler.py <op> <input> [options] [-o output]

    line 75
  2. Very specific:

    Create a JSON rules file for validate:

    line 177

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Data Wrangler

Manipulate tabular data (CSV, Excel, JSON, Parquet, TSV) w/ pandas-powered scripts. Two scripts cover all operations: data_wrangler.py for data ops, excel_toolkit.py for Excel-specific features.

When to Use

  • User asks to read, edit, filter, sort, or transform CSV/Excel/JSON/Parquet/TSV files
  • User asks to merge/join datasets, deduplicate, fill missing values, or validate data
  • User asks to create Excel workbooks w/ formatting, dropdowns, freeze panes, or multi-sheet
  • User asks to pivot, unpivot, group-by, aggregate, sample, or split datasets
  • User asks to add computed columns, rename columns, cast types, or apply formulas
  • User asks to convert between data formats (CSV -> Excel, JSON -> Parquet, etc.)
  • User asks to inspect/profile data structure, types, nulls, stats

Prerequisites

# Required
pip install pandas openpyxl

# Optional (per feature)
pip install pyarrow          # Parquet support
pip install xlrd             # Legacy .xls read
pip install pandasql         # SQL queries on DataFrames
pip install fastparquet      # Alternative Parquet engine

Quick Routing

TaskScriptCommand
Inspect/profile datadata_wrangler.pyinspect
Filter rowsdata_wrangler.pyfilter --where "expr"
Sort by columnsdata_wrangler.pysort --by Col --desc
Group & aggregatedata_wrangler.pygroup --by Col --agg "Col:func"
Merge/join filesdata_wrangler.pymerge f2 --on Key --how left
Pivot / unpivotdata_wrangler.pypivot --index/--unpivot
Remove duplicatesdata_wrangler.pydedupe --subset "Col"
Fill missing valuesdata_wrangler.pyfill --column Col --strategy mean
Drop cols/rowsdata_wrangler.pydrop --columns "A,B"
Rename columnsdata_wrangler.pyrename --map "old:new"
Cast typesdata_wrangler.pycast --column Col --dtype datetime
Computed columnsdata_wrangler.pyderive --formula "New = A + B"
Random sampledata_wrangler.pysample --n 100
Split by valuesdata_wrangler.pysplit --by Region
Validate rulesdata_wrangler.pyvalidate --rules rules.json
Apply formulasdata_wrangler.pyformula --expr "C=A+B"
Convert formatsdata_wrangler.pyconvert -o data.xlsx
SQL queriesdata_wrangler.pyquery --sql "SELECT..."
List Excel sheetsexcel_toolkit.pysheets
Extract sheetexcel_toolkit.pyextract --sheet Sales -o sales.csv
Combine -> xlsxexcel_toolkit.pycombine *.csv -o combined.xlsx
Format headersexcel_toolkit.pyformat --header-style bold,blue --autowidth
Freeze panesexcel_toolkit.pyfreeze --at B2
Auto-filterexcel_toolkit.pyautofilter
Dropdown validationexcel_toolkit.pyvalidate --column Status --values "Open,Closed"
Protect sheetexcel_toolkit.pyprotect --password secret
Create workbookexcel_toolkit.pycreate --columns "Name,Age" -o template.xlsx

Usage Patterns

Data Operations (data_wrangler.py)

All operations follow: python3 scripts/data_wrangler.py <op> <input> [options] [-o output]

# Inspect
python3 data_wrangler.py inspect sales.csv
python3 data_wrangler.py inspect data.xlsx --sheet "Q1 Sales" --nrows 1000

# Filter
python3 data_wrangler.py filter data.csv --where "Revenue > 10000" -o high_rev.csv
python3 data_wrangler.py filter data.csv --where 'Status == "active" and Age >= 25' -o active.csv

# Sort
python3 data_wrangler.py sort data.csv --by "Revenue,Name" --desc -o sorted.csv

# Group + Aggregate
python3 data_wrangler.py group data.csv --by Department --agg "Salary:mean,Salary:count,Revenue:sum" -o summary.csv

# Merge
python3 data_wrangler.py merge orders.csv customers.csv --on CustomerID --how left -o joined.csv

# Pivot
python3 data_wrangler.py pivot data.csv --index Name --columns Month --values Sales --aggfunc sum -o pivoted.csv

# Unpivot (melt)
python3 data_wrangler.py pivot wide.csv --index ID --unpivot --var-name Metric --value-name Value -o long.csv

# Deduplicate
python3 data_wrangler.py dedupe data.csv --subset "Email" --keep first -o clean.csv

# Fill nulls
python3 data_wrangler.py fill data.csv --column "Revenue,Profit" --strategy mean -o filled.csv

# Drop columns
python3 data_wrangler.py drop data.csv --columns "TempCol,Notes" -o trimmed.csv
python3 data_wrangler.py drop data.csv --null-threshold 0.5 -o cleaned.csv

# Rename
python3 data_wrangler.py rename data.csv --map "old_name:new_name,col2:Column2" -o renamed.csv
python3 data_wrangler.py rename data.csv --snake -o snake_case.csv

# Cast types
python3 data_wrangler.py cast data.csv --column Date --dtype datetime --date-format "%Y-%m-%d" -o typed.csv

# Computed columns
python3 data_wrangler.py derive data.csv --formula "Profit = Revenue - Cost" -o enriched.csv

# Sample
python3 data_wrangler.py sample large.csv --n 500 --seed 42 -o sample.csv

# Split by value
python3 data_wrangler.py split data.csv --by Region --output-dir ./by_region/

# Validate
python3 data_wrangler.py validate data.csv --rules validation_rules.json -o report.json

# Formula
python3 data_wrangler.py formula data.xlsx --expr "Total=Price*Quantity" -o calculated.xlsx

# Convert
python3 data_wrangler.py convert data.csv -o data.xlsx
python3 data_wrangler.py convert data.xlsx -o data.json
python3 data_wrangler.py convert data.json -o data.parquet

# SQL query
python3 data_wrangler.py query data.csv --sql "SELECT Name, AVG(Salary) FROM df WHERE Dept='Eng' GROUP BY Name"

Excel Operations (excel_toolkit.py)

All operations follow: python3 scripts/excel_toolkit.py <op> <input> [options] [-o output]

# List sheets
python3 excel_toolkit.py sheets workbook.xlsx

# Extract sheet
python3 excel_toolkit.py extract workbook.xlsx --sheet "Sales Q1" -o sales_q1.csv

# Combine multiple files into multi-sheet xlsx
python3 excel_toolkit.py combine sales.csv inventory.csv orders.csv -o report.xlsx

# Format
python3 excel_toolkit.py format data.xlsx --header-style bold,blue --autowidth --zebra -o styled.xlsx

# Freeze panes
python3 excel_toolkit.py freeze data.xlsx --at B2 -o frozen.xlsx

# Auto-filter
python3 excel_toolkit.py autofilter data.xlsx -o filtered.xlsx

# Dropdown validation
python3 excel_toolkit.py validate data.xlsx --column Status --values "Open,Closed,Pending" -o validated.xlsx

# Protect
python3 excel_toolkit.py protect data.xlsx --password mypass -o protected.xlsx

# Create template
python3 excel_toolkit.py create --columns "Name,Email,Department,Start Date,Salary" -o template.xlsx

Validation Rules Format

Create a JSON rules file for validate:

{
  "rules": [
    {"column": "Email", "type": "not_null"},
    {"column": "Email", "type": "pattern", "regex": "^[^@]+@[^@]+\\.[^@]+$"},
    {"column": "ID", "type": "unique"},
    {"column": "Age", "type": "range", "min": 0, "max": 150},
    {"column": "Status", "type": "enum", "values": ["active", "inactive", "pending"]}
  ]
}

Rule types: not_null, unique, range (min/max), pattern (regex), enum (allowed values).

Fill Strategies

StrategyBehavior
meanFill w/ column mean (numeric)
medianFill w/ column median (numeric)
modeFill w/ most frequent value
zeroFill w/ 0
emptyFill w/ empty string
ffillForward fill (carry last value)
bfillBackward fill
dropDrop rows w/ nulls in column
value:<v>Fill w/ specific value

Supported Formats

FormatReadWriteDependency
CSVYY(builtin)
TSVYY(builtin)
XLSXYYopenpyxl
XLSYNxlrd
JSONYY(builtin)
JSONLYY(builtin)
ParquetYYpyarrow

Integration w/ file-converter

Pipeline data between skills:

# 1. Convert YAML -> CSV (file-converter), then wrangle
python3 .claude/skills/file-converter/scripts/csv_json_yaml.py data.yaml data.csv
python3 .claude/skills/data-wrangler/scripts/data_wrangler.py filter data.csv --where "Status == 'active'" -o filtered.csv

# 2. Wrangle, then convert to PDF report
python3 data_wrangler.py group data.csv --by Dept --agg "Salary:mean,count" -o summary.csv
# (Use file-converter to render summary as markdown -> PDF)

# 3. Excel -> JSON -> YAML pipeline
python3 data_wrangler.py convert data.xlsx -o data.json
python3 .claude/skills/file-converter/scripts/csv_json_yaml.py data.json data.yaml

Pandas Query Syntax Reference

Filter expressions use pandas query syntax:

PatternExample
ComparisonAge > 30, Revenue >= 10000
EqualityStatus == "active", Region != "East"
String containsName.str.contains("Smith")
Multiple conditionsAge > 25 and Status == "active"
OR conditionsRegion == "East" or Region == "West"
IN listStatus in ["active", "pending"]
NOT INStatus not in ["closed", "archived"]
Null checkRevenue.notna(), Email.isna()
BetweenAge >= 18 and Age <= 65

Aggregation Functions

Available for group --agg and pivot --aggfunc:

sum, mean, median, min, max, count, std, var, first, last, nunique

Spec format: "Column:function" — multiple: "Salary:mean,Salary:count,Revenue:sum"

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.