Matthew Burke

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: (1) (2) ABP 416.674*** 397.583*** (69.495) (70.87) Age 37.241 24.704 (64.117) (65.411) BMI 787.179*** 789.742*** (65.424) (66.887) S1 197.852 (143.812) S2 -169.251 (142.744) Sex -106.578* -82.862 (62.125) (64.851) const 152.133*** 152.133*** (2.853) (2.853) Observations 442.0 442.0 R2 0.4 0.403 Adjusted R2 0.395 0.395 Residual Std. Error 59.976(df = 437.0) 59.982(df = 435.0) F Statistic 72.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!