python-panel-data — Claude Code skill for panel data analysis
python-panel-data is a Claude Code skill that generates Python code for panel-data analysis, including fixed- and random-effects models, difference-in-differences, and regression tables.
CC0-1.0 163 installs ★ 675 updated 2026-09-26
npx skills add meleantonio/awesome-econ-ai-stuff --skill python-panel-data -a claude-codeWhat python-panel-data does
The skill guides Python analysis of panel data. It can generate code to load and clean data with pandas, set a panel index, and estimate models with PanelOLS or RandomEffects from linearmodels. It also helps interpret coefficients and consider diagnostic checks. Results can be formatted as a table or exported to LaTeX.
Before writing code, it asks about the observation unit, panel identifiers, variables, effects, and how to cluster standard errors. Those choices matter: incorrect identifiers or clustering can make the model output unsuitable. The requirements are Python 3.10+ and the pandas, linearmodels, and statsmodels packages; install them with pip install pandas linearmodels statsmodels.
What it helps with
- estimate fixed effects for entities and time periods
- run difference-in-differences on panel data
- cluster standard errors at the chosen level
- prepare a regression table or export results to LaTeX
- check panel identifiers and missing values
Example prompts for the agent
- Estimate a panel model with entity and year fixed effects, clustering standard errors by entity.
- Run a difference-in-differences analysis with state and year effects, then explain the main coefficients.
- Format the panel regression results as a table and export them to LaTeX.
How to install python-panel-data
1Skills CLI (Vercel)
npx skills add meleantonio/awesome-econ-ai-stuff --skill python-panel-data -a claude-code2Manually: put the files in place
~/.claude/skills/python-panel-data/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/python-panel-data/
1Skills CLI (Vercel)
npx skills add meleantonio/awesome-econ-ai-stuff --skill python-panel-data -a codex2Manually: put the files in place
.agents/skills/python-panel-data/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add meleantonio/awesome-econ-ai-stuff --skill python-panel-data -a cursor2Manually: put the files in place
.cursor/skills/python-panel-data/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install meleantonio/awesome-econ-ai-stuff _skills/analysis/python-panel-data2Manually: put the files in place
.github/skills/python-panel-data/SKILL.md1Skills CLI (Vercel)
npx skills add meleantonio/awesome-econ-ai-stuff --skill python-panel-data -a gemini-cli2Platform CLI
gemini skills install https://github.com/meleantonio/awesome-econ-ai-stuff --path _skills/analysis/python-panel-dataManually: put the files in place
.devin/skills/python-panel-data/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add meleantonio/awesome-econ-ai-stuff --skill python-panel-data -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about python-panel-data
How do I install python-panel-data in Claude Code?
Run npx skills add meleantonio/awesome-econ-ai-stuff --skill python-panel-data -a claude-code. The skill file is located at ~/.claude/skills/python-panel-data/SKILL.md.
What does python-panel-data do?
It helps generate Python code for panel data analysis, including fixed- and random-effects models, difference-in-differences, and regression results.
Which packages does python-panel-data require?
It requires Python 3.10+ and the pandas, linearmodels, and statsmodels packages. Install them with pip install pandas linearmodels statsmodels.
Source text
SKILL.md · CC0-1.0
---
name: python-panel-data
description: Panel data analysis with Python using linearmodels and pandas.
workflow_stage: analysis
compatibility:
- claude-code
- cursor
- codex
- gemini-cli
author: Awesome Econ AI Community
version: 1.0.0
tags:
- python
- pandas
- linearmodels
- panel-data
---
# Python Panel Data
## Purpose
This skill helps economists run panel data models in Python using `pandas`, `statsmodels`, and `linearmodels`, with correct fixed effects, clustering, and diagnostics.
## When to Use
- Estimating fixed effects or random effects models
- Running difference-in-differences on panel data
- Creating regression tables and plots in Python
## Instructions
Follow these steps to complete the task:
### Step 1: Understand the Context
Before generating any code, ask the user:
- What is the unit of observation and panel identifiers?
- Which outcomes and regressors are required?
- What fixed effects or time effects are needed?
- How should standard errors be clustered?
### Step 2: Generate the Output
Based on the context, generate Python code that:
1. **Loads and cleans the data** with `pandas`
2. **Sets a MultiIndex** for panel structure
3. **Fits the model** using `linearmodels.PanelOLS` or `RandomEffects`
4. **Outputs results** in a readable table and optional LaTeX
### Step 3: Verify and Explain
After generating output:
- Interpret key coefficients
- Note assumptions (strict exogeneity, parallel trends, etc.)
- Suggest robustness checks (alternative clustering, placebo tests)
## Example Prompts
- "Run a two-way fixed effects model with firm and year effects"
- "Estimate a DiD using state and year fixed effects"
- "Export panel regression results to LaTeX"
## Example Output
```python
# ============================================
# Panel Data Analysis in Python
# ============================================
import pandas as pd
from linearmodels.panel import PanelOLS
# Load data
df = pd.read_csv("panel_data.csv")
# Set panel index
df = df.set_index(["firm_id", "year"])
# Create treatment indicator
df["treat_post"] = df["treated"] * df["post"]
# Two-way fixed effects model
model = PanelOLS.from_formula(
"outcome ~ 1 + treat_post + EntityEffects + TimeEffects",
data=df
)
results = model.fit(cov_type="clustered", cluster_entity=True)
print(results.summary)
```
## Requirements
### Software
- Python 3.10+
### Packages
- `pandas`
- `linearmodels`
- `statsmodels`
Install with:
```bash
pip install pandas linearmodels statsmodels
```
## Best Practices
1. **Always verify panel identifiers** and balanced vs unbalanced panels
2. **Cluster standard errors** at the appropriate level
3. **Check for missing data** before estimation
## Common Pitfalls
- Failing to set a proper panel index
- Using pooled OLS when fixed effects are required
- Misinterpreting coefficients without accounting for fixed effects
## References
- [linearmodels documentation](https://bashtage.github.io/linearmodels/)
- [statsmodels documentation](https://www.statsmodels.org/)
- [Wooldridge (2010) Econometric Analysis of Cross Section and Panel Data](https://mitpress.mit.edu/9780262232586/)
## Changelog
### v1.0.0
- Initial release
© Awesome Econ AI Community · CC0-1.0 · meleantonio/awesome-econ-ai-stuff