Stargazer Python Library
Matthew Burke
Matthew Burke
1 min read



Introducing the Stargazer Python Package:

I really like the stargazer package in R. It’s a fantastic library for creating beautiful, publication worthy regression tables, and I was bummed when they didn’t have a version in Python which is what I’m primarily working in these days. So.. naturally I created my own implementation and figured I would share it since there must be some others who love both R and Python out there and are looking for feature parity between the two. It probably has a few bugs but I figured something was better than nothing. Here’s an example of the output from my current version (with my blog styling automatically applied).

Dependent variable:
Adjusted R20.3950.395
Residual Std. Error59.976(df = 437.0)59.982(df = 435.0)
F Statistic72.913***(df = 4.0; 437.0)48.915***(df = 6.0; 435.0)
Note:p<0.1; p<0.05; p<0.01

Here’s an example of a raw example without any styling I generated using the package:

When would I use these?

The main situation that people tend to use the R version of stargazer is in reporting regression results in academic papers. It easily allows you to compare multiple regression results, and this lends itself to comparing results between models that have experimentally imposed effects and those that don’t. this easily allows the user to view the differences in coefficients, statistical significance and the effects of the new variable introduced by the experiment.

It currently supports LaTeX and HTML output, but my goal is eventually support Markdown and ASCII text as well.

How do I use it?

Check out the github repo or download using pip install stargazer, and please let me know if you have any feedback/feature requests!