Skip to main content

MakeTables

License Python Versions PyPI -Version File an Issue Downloads Downloads PyPI

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.

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

Model Support

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!

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 also supporting other statistical packages.

Authors

Installation

From PyPI

pip install maketables

Development Installation

# Clone the repository
git clone https://github.com/yourusername/maketables.git
cd maketables

# Install in development mode
pip install -e .

Quick Start

Descriptive Statistics Table

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"])

Regression Tables

with pyfixest

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])

with statsmodels

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"])

Main Classes

MTable

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)

DTable

Extends MTable for descriptive statistics:

  • Automatic calculation of summary statistics
  • Grouping by categorical variables (rows and columns)
  • Customizable statistic labels and formatting

ETable

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,...)

BTable

Extends MTable for simple balance tables.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Metadata

Release files for maketables 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maketables 0.1.9
File Size Uploaded
maketables-0.1.9.tar.gz 73.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maketables 0.1.9
File Interpreter ABI Platform
maketables-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 149.4 kB

Release files / maketables-0.1.9.tar.gz

Download URL maketables-0.1.9.tar.gz
Size 73.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6701266f815b92b5612c057a10580d07e77c66c69a77e68139d441bf14c3429c
BLAKE2b-256 checksum
How to use checksums
9acda61ab0cd638ca311367eec31d8ef633600322d8de4780de44ae781352d6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / maketables-0.1.9-py3-none-any.whl

Download URL maketables-0.1.9-py3-none-any.whl
Size 76.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a577b29d7da1ae226409c4d4975e7f1f67947e7cd1cbf8d09a344aafb8269ccc
BLAKE2b-256 checksum
How to use checksums
2a90f666d68aef8c01a50d88fa86e5ff4ffc68f0ecb785a076d58f4ffaab85f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page