Skip to main content

MakeTables

PyPI - Version Python Versions License Tests Downloads Downloads per month Open issues

A Python package for creating publication-ready tables from regression results, descriptive statistics, and balance tables with output to LaTeX, Word, Typst, and HTML (HTML tables are created with Great Tables).

Overview

MakeTables provides a unified interface for generating tables such as:

The package supports multiple output formats including:

  • Great Tables (HTML)
  • LaTeX
  • Microsoft Word (docx) documents
  • Typst
NoteFeedback Welcome

Bug reports and feature requests through GitHub Issues are highly welcome.

Origin

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 and support other statistical packages.

Authors

Installation

From PyPI

pip install maketables

Development Installation

git clone https://github.com/py-econometrics/maketables.git
cd maketables
pip install -e .

Quick Example

import pandas as pd
import maketables as mt
import pyfixest as pf

# Load your data (here using a sample Stata dataset with the import_dta function that also stores variable labels)
df = mt.import_dta("data/auto.dta")

# Create descriptive statistics table
mt.DTable(df, vars=["mpg","weight","length"], bycol=["foreign"])
Domestic Foreign
N Mean Std. Dev. N Mean Std. Dev.
Mileage (mpg) 52.00 19.83 4.74 22.00 24.77 6.61
Weight (lbs.) 52.00 3,317.12 695.36 22.00 2,315.91 433.00
Length (in.) 52.00 196.13 20.05 22.00 168.55 13.68
# Fit your models (here using pyfixest)
est1 = pf.feols("mpg ~ weight", data=df)
est2 = pf.feols("mpg ~ weight + length", data=df)

# Make a regression table
mt.ETable([est1, est2])
Mileage (mpg)
(1) (2)
coef
Weight (lbs.) -0.006***
(0.001)
-0.004**
(0.002)
Length (in.) -0.080
(0.055)
Intercept 39.440***
(1.614)
47.885***
(6.088)
stats
Observations 74 74
R2 0.652 0.661
Significance levels: * p < 0.1, ** p < 0.05, *** p < 0.01. Format of coefficient cell: Coefficient (Std. Error)

Get Started