pyfixest
Skill63 starsChanged 5 months agoMITView on GitHub
Fast high-dimensional fixed-effects regression in Python with pyfixest (fixest-like syntax). Use for OLS/IV/Poisson with many FEs, cluster-robust SEs, modern DiD (did2s, Sun-Abraham), and publication tables — the Python counterpart to Stata reghdfe/fixest for accounting and finance panels.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- DAAF-Contribution-Community/daaftheir own version, first seen Nov 3, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- DAAF-Contribution-Community/daaf★ 239same name
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
- python-panel-dataSkill
- 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
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 75
Prefer package DiD helpers (did2s, Sun-Abraham / local projections as documented upstream) over naive TWFE when adoption is staggered.
- Distinctive: line 90
Never paste coefficients without SE and N
≈ “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.
PyFixest for empirical accounting & finance
When to use
- Firm–year / firm–quarter panels with firm and year (or industry×year) fixed effects
- High-dimensional FE that are slow in
linearmodelsor plainstatsmodels - IV with FE, Poisson/PPML with FE, or modern DiD helpers in Python
- You already know Stata
reghdfe/ Rfixestand want the same grammar in Python
Prefer python-panel-data when the design is a simple two-way FE / RE with linearmodels and you want textbook panel diagnostics. Prefer r-econometrics / Stata skills when the paper's replication package is R/Stata-first.
Install
python -m pip install pyfixest
# optional: python -m pip install "pyfixest[plots]"Docs: pyfixest.org
Iron law: specify clustering and FE before estimating
- State the unit of treatment / residual correlation (usually firm, sometimes industry or CEO)
- State fixed effects that absorb the design (firm + year; firm + industry×year; etc.)
- Estimate with matching
vcov/ cluster - Inspect N, absorbed FE counts, and a coefficient sample before writing results into a paper
Quick patterns
OLS with multi-way FE + firm clustering
import pyfixest as pf
fit = pf.feols(
"roa ~ treat + size + mb | gvkey + fyear",
data=df,
vcov={"CRV1": "gvkey"},
)
fit.summary()Multiple specs (fixest-style)
fit = pf.feols(
"roa ~ treat + size | gvkey + fyear",
data=df,
vcov={"CRV1": "gvkey"},
)
# Compare specs with pf.etable([...]) for paper tablesIV with FE
fit = pf.feols(
"y ~ 1 | gvkey + fyear | endog ~ instrument",
data=df,
vcov={"CRV1": "gvkey"},
)Staggered DiD / event study
Prefer package DiD helpers (did2s, Sun-Abraham / local projections as documented upstream) over naive TWFE when adoption is staggered. Report an event-study plot from a robust estimator, not only TWFE — see econ-writing-plus for narrative conventions.
Accounting / finance defaults
| Design | Typical FE | Cluster |
| Firm–year treatment | gvkey + fyear | firm (gvkey) |
| Industry shock | gvkey + fyear or gvkey + industry^fyear | firm; sometimes industry |
| CEO / executive panel | exec + year or firm + year | firm or exec (justify) |
| State policy | firm + year | firm; often state×year FE debate in text |
Journal-ready output
- Export LaTeX via pyfixest / maketables helpers; pair with
latex-tablesfor house style - Report within R² / FE set / cluster level in table notes
- Never paste coefficients without SE and N
Checklist before claiming results
- Sample filters documented (Compustat
indfmt/datafmt/popsrc/consolif from WRDS) - FE and cluster match the identification story
- Staggered timing → not only TWFE
- One exhibit inspected (sign, magnitude, N) against a raw crosstab
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.

