python-panel-data
Skill63 starsChanged 5 months agoMITView on GitHub
Panel data analysis with Python using linearmodels and pandas.
- Installs packages
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- Ricardo-kui/claude-skillsedited, first seen Sep 10, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- Ricardo-kui/claude-skills★ 085% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- install/claude.mdCLAUDE.md
- daskSkill
- econ-visualizationSkill
- geopandasSkill
- matplotlibSkill
- plotlySkill
- polarsSkill
- pymc-bayesian-modelingSkill
- scikit-learnSkill
- seabornSkill
- statistical-analysisSkill
- statsmodelsSkill
- pyfixestSkill
- r-econometricsSkill
- stata-data-cleaningSkill
- stata-regressionSkill
- wrdsSkill
- api-data-fetcherSkill
- citation-managementSkill
- datacommons-clientSkill
- exploratory-data-analysisSkill
- financial-text-nlpSkill
- literature-reviewSkill
- lit-review-assistantSkill
- openalex-apiSkill
- paper-2-acfin-webSkill
- research-ideationSkill
- research-lookupSkill
- sec-edgarSkill
- web-scrapeSkill
- academic-paper-writerSkill
- beamer-presentationSkill
- econ-humanizer-plusSkill
- econ-humanizerSkill
- econ-refereeSkill
- econ-slidesSkill
- econ-writeSkill
- econ-writing-plusSkill
- hypothesis-generationSkill
- latex-econ-modelSkill
- latex-postersSkill
- latex-tablesSkill
- paper-pdfSkill
- peer-reviewSkill
- scholar-evaluationSkill
- scientific-critical-thinkingSkill
- venue-templatesSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Follow these steps to complete the task:
- Distinctive: line 40
Before generating any code, ask the user:
- Distinctive: line 120
Check for missing data: before estimation
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Barrios Skills — John Barrios's curated workflow for economists and accountants. Prioritize reproducible empirical work, clear identification language, and journal-ready output.
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:
- Loads and cleans the data with
pandas - Sets a MultiIndex for panel structure
- Fits the model using
linearmodels.PanelOLSorRandomEffects - 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
# ============================================
# 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
pandaslinearmodelsstatsmodels
Install with:
pip install pandas linearmodels statsmodelsBest Practices
- Always verify panel identifiers and balanced vs unbalanced panels
- Cluster standard errors at the appropriate level
- 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
- statsmodels documentation
- Wooldridge (2010) Econometric Analysis of Cross Section and Panel Data
Changelog
v1.0.0
- Initial release
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
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.

