Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add meleantonio/awesome-econ-ai-stuff --skill python-panel-data -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/python-panel-data/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/python-panel-data/

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

Similar skills

All skills for Data and databases →

From the same set12

The whole set →
r-econometrics r-econometrics generates R code for causal inference and panel data using fixest, complete with diagnostics and publication tables. Useful for IV, DiD, and RDD research designs. CX Codex +1 340installs beamer-presentation beamer-presentation is a Claude Code skill that builds academic Beamer decks from a paper or project, with timed structure, themes, charts, and tables. CX Codex +1 285installs lit-review-assistant lit-review-assistant structures economics literature reviews, crafts database queries, and tracks research gaps. Helps synthesize empirical papers into standardized markdown templates. CX Codex +1 241installs api-data-fetcher The api-data-fetcher skill helps an agent pull economic indicators from FRED, World Bank, and other APIs. Use it for datasets, recurring updates, or cross-country panels. CX Codex +1 208installs econ-visualization econ-visualization generates publication-ready figures and charts for economics research in R or Python. CX Codex +1 202installs research-ideation research-ideation guides economists from raw observations or datasets to testable research questions. Useful when starting dissertation projects or designing policy evaluations. CX Codex +1 196installs latex-econ-model latex-econ-model typesets economic theory models in LaTeX using standard academic notation, from utility optimization to dynamic programming setups. CX Codex +1 147installs latex-tables Creates clean LaTeX tables for regression results and summary statistics using academic formatting standards. Use it when you need to format statistical output for journal submission. CX Codex +1 128installs

Project sponsors

Companies that keep this analytics open