{"id":13665592,"url":"https://github.com/StatsReporting/stargazer","last_synced_at":"2025-04-26T08:32:27.205Z","repository":{"id":44599817,"uuid":"138524735","full_name":"StatsReporting/stargazer","owner":"StatsReporting","description":"Python implementation of the R stargazer multiple regression model creation tool","archived":false,"fork":false,"pushed_at":"2024-07-26T15:07:14.000Z","size":450,"stargazers_count":200,"open_issues_count":32,"forks_count":53,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-17T22:45:35.134Z","etag":null,"topics":["latex","python","regression-models","stargazer"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StatsReporting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-25T00:13:13.000Z","updated_at":"2025-04-15T21:17:20.000Z","dependencies_parsed_at":"2023-07-24T23:52:47.910Z","dependency_job_id":"ecb5ee1b-3c73-4d43-8e5e-60d4eb15eb91","html_url":"https://github.com/StatsReporting/stargazer","commit_stats":{"total_commits":103,"total_committers":11,"mean_commits":9.363636363636363,"dds":"0.41747572815533984","last_synced_commit":"e321e873fa6a43b2252350f935e68b3726e5468a"},"previous_names":["statsreporting/stargazer","mwburke/stargazer"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatsReporting%2Fstargazer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatsReporting%2Fstargazer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatsReporting%2Fstargazer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StatsReporting%2Fstargazer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StatsReporting","download_url":"https://codeload.github.com/StatsReporting/stargazer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250960238,"owners_count":21514418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["latex","python","regression-models","stargazer"],"created_at":"2024-08-02T06:00:43.314Z","updated_at":"2025-04-26T08:32:24.247Z","avatar_url":"https://github.com/StatsReporting.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"# Stargazer\n\nThis is a python port of the R stargazer package that can be found [on CRAN](https://CRAN.R-project.org/package=stargazer). I was disappointed that there wasn't equivalent functionality in any python packages I was aware of so I'm re-implementing it here.\n\nThere is an experimental function in the [statsmodels.regression.linear_model.OLSResults.summary2](http://www.statsmodels.org/dev/generated/statsmodels.regression.linear_model.OLSResults.summary2.html) that can report single regression model results in HTML/CSV/LaTeX/etc, but it still didn't quite fulfill what I was looking for.\n\nThe python package is object oriented now with chained commands to make changes to the rendering parameters, which is hopefully more pythonic and the user doesn't have to put a bunch of arguments in a single function.\n\n## Installation\n\nYou can install this package through PyPi with `pip install stargazer` or just clone the repo and take the `stargazer.py` file since it's the only one in the package.\n\n### Dependencies\n\nIt depends on `statsmodels`, which in turn depends on several other libraries like `pandas`, `numpy`, etc\n\n## Editing Features\n\nThis library implements many of the customization features found in the original package. Examples of most can be found [in the examples jupyter notebook](https://github.com/StatsReporting/stargazer/blob/master/examples.ipynb) and a full list of the methods/features is here below:\n\n* `title`: custom title\n* `show_header`: display or hide model header data\n* `show_model_numbers`: display or hide model numbers\n* `custom_columns`: custom model names and model groupings\n* `significance_levels`: change statistical significance thresholds\n* `significant_digits`: change number of significant digits\n* `show_confidence_intervals`: display confidence intervals instead of variance\n* `dependent_variable_name`: rename dependent variable\n* `rename_covariates`: rename covariates\n* `covariate_order`: reorder covariates\n* `reset_covariate_order`: reset covariate order to original ordering\n* `show_degrees_of_freedom`: display or hide degrees of freedom\n* `custom_note_label`: label notes section at bottom of table\n* `add_custom_notes`: add custom notes to section at bottom of the table\n* `add_line`: add a custom line to the table\n* `append_notes`: display or hide statistical significance thresholds\n\nThese features are agnostic of the rendering type and will be applied whether the user outputs in HTML, LaTeX, etc\n\n## Example\n\nHere is an examples of how to quickly get started with the library. More examples can be found in the `examples.ipynb` file in the github repo. The examples all use the scikit-learn diabetes dataset, but it is not a dependency for the package.\n\n### OLS Models Preparation\n\n```python\nimport pandas as pd\nfrom sklearn import datasets\nimport statsmodels.api as sm\nfrom stargazer.stargazer import Stargazer\n\ndiabetes = datasets.load_diabetes()\ndf = pd.DataFrame(diabetes.data)\ndf.columns = ['Age', 'Sex', 'BMI', 'ABP', 'S1', 'S2', 'S3', 'S4', 'S5', 'S6']\ndf['target'] = diabetes.target\n\nest = sm.OLS(endog=df['target'], exog=sm.add_constant(df[df.columns[0:4]])).fit()\nest2 = sm.OLS(endog=df['target'], exog=sm.add_constant(df[df.columns[0:6]])).fit()\n\n\nstargazer = Stargazer([est, est2])\n```\n\n### HTML Example\n\n```python\nstargazer.render_html()\n```\n\n\u003ctable style=\"text-align:center\"\u003e\u003ctr\u003e\u003ctd colspan=\"3\" style=\"border-bottom: 1px solid black\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd colspan=\"2\"\u003e\u003cem\u003eDependent variable: target\u003c/em\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd\u003e(1)\u003c/td\u003e\u003ctd\u003e(2)\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd colspan=\"3\" style=\"border-bottom: 1px solid black\"\u003e\u003c/td\u003e\u003c/tr\u003e\n\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003eABP\u003c/td\u003e\u003ctd\u003e416.674\u003csup\u003e***\u003c/sup\u003e\u003c/td\u003e\u003ctd\u003e397.583\u003csup\u003e***\u003c/sup\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd\u003e(69.495)\u003c/td\u003e\u003ctd\u003e(70.870)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003eAge\u003c/td\u003e\u003ctd\u003e37.241\u003csup\u003e\u003c/sup\u003e\u003c/td\u003e\u003ctd\u003e24.704\u003csup\u003e\u003c/sup\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd\u003e(64.117)\u003c/td\u003e\u003ctd\u003e(65.411)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003eBMI\u003c/td\u003e\u003ctd\u003e787.179\u003csup\u003e***\u003c/sup\u003e\u003c/td\u003e\u003ctd\u003e789.742\u003csup\u003e***\u003c/sup\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd\u003e(65.424)\u003c/td\u003e\u003ctd\u003e(66.887)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003eS1\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd\u003e197.852\u003csup\u003e\u003c/sup\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd\u003e(143.812)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003eS2\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd\u003e-169.251\u003csup\u003e\u003c/sup\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd\u003e(142.744)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003eSex\u003c/td\u003e\u003ctd\u003e-106.578\u003csup\u003e*\u003c/sup\u003e\u003c/td\u003e\u003ctd\u003e-82.862\u003csup\u003e\u003c/sup\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd\u003e(62.125)\u003c/td\u003e\u003ctd\u003e(64.851)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003econst\u003c/td\u003e\u003ctd\u003e152.133\u003csup\u003e***\u003c/sup\u003e\u003c/td\u003e\u003ctd\u003e152.133\u003csup\u003e***\u003c/sup\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align:left\"\u003e\u003c/td\u003e\u003ctd\u003e(2.853)\u003c/td\u003e\u003ctd\u003e(2.853)\u003c/td\u003e\u003c/tr\u003e\n\n\u003ctd colspan=\"3\" style=\"border-bottom: 1px solid black\"\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd style=\"text-align: left\"\u003eObservations\u003c/td\u003e\u003ctd\u003e442\u003c/td\u003e\u003ctd\u003e442\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"text-align: left\"\u003eR\u003csup\u003e2\u003c/sup\u003e\u003c/td\u003e\u003ctd\u003e0.400\u003c/td\u003e\u003ctd\u003e0.403\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"text-align: left\"\u003eAdjusted R\u003csup\u003e2\u003c/sup\u003e\u003c/td\u003e\u003ctd\u003e0.395\u003c/td\u003e\u003ctd\u003e0.395\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"text-align: left\"\u003eResidual Std. Error\u003c/td\u003e\u003ctd\u003e59.976 (df=437)\u003c/td\u003e\u003ctd\u003e59.982 (df=435)\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"text-align: left\"\u003eF Statistic\u003c/td\u003e\u003ctd\u003e72.913\u003csup\u003e***\u003c/sup\u003e (df=4; 437)\u003c/td\u003e\u003ctd\u003e48.915\u003csup\u003e***\u003c/sup\u003e (df=6; 435)\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd colspan=\"3\" style=\"border-bottom: 1px solid black\"\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd style=\"text-align: left\"\u003eNote:\u003c/td\u003e\u003ctd colspan=\"2\" style=\"text-align: right\"\u003e\u003csup\u003e*\u003c/sup\u003ep\u0026lt;0.1; \u003csup\u003e**\u003c/sup\u003ep\u0026lt;0.05; \u003csup\u003e***\u003c/sup\u003ep\u0026lt;0.01\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n### LaTeX Example\n\n```python\nstargazer.render_latex()\n```\n\n![](https://raw.githubusercontent.com/StatsReporting/stargazer/master/latex_example.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStatsReporting%2Fstargazer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FStatsReporting%2Fstargazer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStatsReporting%2Fstargazer/lists"}