<< All versions
Skill v1.0.0
currentLLM-judged scan90/100xilele777/poirot/data-analysis
──Details
PublishedOctober 24, 2026 at 11:30 AM
Content Hashsha256:578b5980cd23b82a...
Git SHA19152ef7e17c
──Files
Files (1 file, 3.9 KB)
SKILL.md3.9 KBactive
SKILL.md · 160 lines · 3.9 KB
version: "1.0.0" name: data-analysis description: "Analyze Excel/CSV files with DuckDB SQL via bash." allowed-tools:
- bash
- read_file
- write_file
enabled: true related-skills: [consulting-analysis] license: MIT author: Adapted from deer-flow (Bytedance, MIT)
Data Analysis
Overview
Analyzes user-provided Excel (.xlsx/.xls) or CSV files using DuckDB — an in-process analytical SQL engine. Supports schema inspection, SQL querying, statistical summaries, and result export.
Poirot note: The original deer-flow skill uses a bundledscripts/analyze.pyhelper. Poirot doesn't bundle that script, so thisversion usesbashwithpython3+duckdbdirectly. Install duckdb first:pip install duckdb.
When to Use
- User uploads Excel/CSV files and wants analysis
- User wants statistics, summaries, pivot tables, or SQL queries on data
- User wants to filter, join, or aggregate structured data
Prerequisites
bash
# Install duckdb if not presentpip install duckdb openpyxl
Workflow
Step 1: Inspect File Structure
bash
python3 -c "import duckdbcon = duckdb.connect()# For CSVresult = con.execute(\"DESCRIBE SELECT * FROM read_csv_auto('data.csv')\").fetchall()for col in result:print(f'{col[0]:30s} {col[1]}')# For Excel (each sheet = a table)result = con.execute(\"SELECT * FROM st_read('data.xlsx', layer='Sheet1') LIMIT 0\").fetchall()# Row countcount = con.execute(\"SELECT COUNT(*) FROM read_csv_auto('data.csv')\").fetchone()[0]print(f'Rows: {count}')"
Step 2: Statistical Summary
bash
python3 -c "import duckdbcon = duckdb.connect()# Describe statisticsprint(con.execute(\"SUMMARIZE SELECT * FROM read_csv_auto('data.csv')\").df().to_string())"
Step 3: SQL Queries
bash
python3 -c "import duckdbcon = duckdb.connect()# Aggregationresult = con.execute('''SELECT category, COUNT(*) as count, AVG(price) as avg_priceFROM read_csv_auto('data.csv')GROUP BY categoryORDER BY count DESC''').fetchall()for row in result:print(row)# Join two filesresult = con.execute('''SELECT a.id, a.name, b.amountFROM read_csv_auto('orders.csv') aJOIN read_csv_auto('payments.csv') b ON a.id = b.order_id''').fetchall()"
Step 4: Export Results
bash
python3 -c "import duckdbcon = duckdb.connect()# Export to CSVcon.execute(\"COPY (SELECT * FROM read_csv_auto('data.csv') WHERE amount > 100) TO 'filtered.csv' (HEADER, DELIMITER ',')\")# Export to JSONcon.execute(\"COPY (SELECT * FROM read_csv_auto('data.csv')) TO 'output.json' (FORMAT JSON)\")"
Common Patterns
Pivot table
sql
SELECTproduct,SUM(CASE WHEN month = 'Jan' THEN amount ELSE 0 END) AS jan,SUM(CASE WHEN month = 'Feb' THEN amount ELSE 0 END) AS feb,SUM(CASE WHEN month = 'Mar' THEN amount ELSE 0 END) AS marFROM read_csv_auto('sales.csv')GROUP BY product
Percentiles
sql
SELECTpercentile_cont(0.5) WITHIN GROUP (ORDER BY price) AS median,percentile_cont(0.95) WITHIN GROUP (ORDER BY price) AS p95FROM read_csv_auto('data.csv')
Multi-sheet Excel
bash
python3 -c "import duckdbcon = duckdb.connect()# List sheetssheets = con.execute(\"SELECT table_name FROM st_geometry_tables()\").fetchall()# Query specific sheetresult = con.execute(\"SELECT * FROM st_read('data.xlsx', layer='Sheet2') LIMIT 10\").fetchall()"
Pitfalls
- DuckDB not installed:
pip install duckdb openpyxlfirst - Large files: DuckDB handles large files well, but
SUMMARIZEon very
large datasets may be slow. Sample first: SELECT * FROM ... TABLESAMPLE 10%
- Encoding: CSV with non-UTF-8 encoding may fail. Specify encoding in
read_csv_auto options.
- Date parsing: DuckDB auto-detects dates, but ambiguous formats may need
explicit strptime parsing.
- Excel formulas:
st_readreads cell values, not formula results. Use
openpyxl directly if you need computed values.