Docs · Function & API Reference · Report Bugs & Request Features · Adding Support for new Model Classes
A Python package for creating publication-ready tables from regression results (statsmodels, pyfixest, linearmodels), descriptive statistics, and balance tables with output to LaTeX, Word, HTML and Typst via Great Tables. To get started, check out the Getting Started Notebook.
MakeTables provides a unified interface for generating tables such as:
- Regression tables from Statsmodels, PyFixest, Linearmodels and Stata
- Descriptive statistics
- Balance tables
The package supports multiple output formats including:
- Great Tables (HTML)
- LaTeX
- Microsoft Word (docx) documents
- Typst
maketables supports creating regression tables for models from the following packages:
It is very easy to add support for new models - either in the maketables code base, or from within your own package via a maketables plug-in. Take a look at the docs to get started, and please feel free to reach out for help!
MakeTables originated as the table output functionality within the pyfixest package and has been moved to this standalone package to provide broader table creation capabilities also supporting other statistical packages.
- Alexander Fischer https://github.com/s3alfisc
- Dirk Sliwka https://dsliwka.github.io/
pip install maketables# Clone the repository
git clone https://github.com/yourusername/maketables.git
cd maketables
# Install in development mode
pip install -e .import pandas as pd
import maketables as mt
# Load your data (here using a sample Stata dataset with the import_dta function that also stores variable labels)
df = mt.import_dta("https://www.stata-press.com/data/r18/auto.dta")
# Create descriptive statistics table
mt.DTable(df, vars=["mpg","weight","length"], bycol=["foreign"])import pyfixest as pf
# Fit your models here using pyfixest
est1 = pf.feols("mpg ~ weight", data=df)
est2 = pf.feols("mpg ~ weight + length", data=df)
# Make the table
mt.ETable([est1, est2])import statsmodels.formula.api as smf
# Generate a dummy variable and label it
df["foreign_i"] = (df["foreign"] == "Foreign")*1
mt.set_var_labels(df, {"foreign_i": "Foreign (indicator)"})
# Fit your models
est1 = smf.ols("foreign_i ~ weight + length + price", data=df).fit()
est2 = smf.probit("foreign_i ~ weight + length + price", data=df).fit(disp=0)
# Make the table
mt.ETable([est1, est2], model_stats=["N","r2","pseudo_r2",""], model_heads=["OLS","Probit"])Base class for all table types with common functionality:
- Multiple output formats (Great Tables, LaTeX, Word)
- Flexible styling and formatting options
- Save and export capabilities
- Can also update tables in existing word documents
- Adapted for use in Jupyter Notebooks and for quarto use (tables automatically rendered as html in notebooks and as latex when rendering to pdf in quarto)
Extends MTable for descriptive statistics:
- Automatic calculation of summary statistics
- Grouping by categorical variables (rows and columns)
- Customizable statistic labels and formatting
Extends MTable for econometric model results:
- Support for statsmodels, pyfixest, and (more experimental) linearmodels
- Many layout options (relabelling of variables, keep/drop, choice of reported statistics, column headings,...)
Extends MTable for simple balance tables.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built on the excellent pyfixest package for econometric models. We gratefully acknowledge the contributors to pyfixest's etable: @s3alfisc, @dsliwka, @Wenzhi-Ding, @juanitorduz, @NKeleher, @blucap, @mortizm1988, @jsr-p, @IshwaraHegde97, @Erica-Ryan, @Dpananos, and @AronNemeth.
- Uses Great Tables for beautiful HTML table output