在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mwburke/stargazer开源软件地址(OpenSource Url):https://github.com/mwburke/stargazer开源编程语言(OpenSource Language):Jupyter Notebook 58.8%开源软件介绍(OpenSource Introduction):StargazerThis is a python port of the R stargazer package that can be found on CRAN. I was disappointed that there wasn't equivalent functionality in any python packages I was aware of so I'm re-implementing it here. There is an experimental function in the statsmodels.regression.linear_model.OLSResults.summary2 that can report single regression model results in HTML/CSV/LaTeX/etc, but it still didn't quite fulfill what I was looking for. The 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. InstallationYou can install this package through PyPi with DependenciesIt depends on Editing FeaturesThis library implements many of the customization features found in the original package. Examples of most can be found in the examples jupyter notebook and a full list of the methods/features is here below:
These features are agnostic of the rendering type and will be applied whether the user outputs in HTML, LaTeX, etc ExampleHere is an examples of how to quickly get started with the library. More examples can be found in the OLS Models Preparationimport pandas as pd
from sklearn import datasets
import statsmodels.api as sm
from stargazer.stargazer import Stargazer
diabetes = datasets.load_diabetes()
df = pd.DataFrame(diabetes.data)
df.columns = ['Age', 'Sex', 'BMI', 'ABP', 'S1', 'S2', 'S3', 'S4', 'S5', 'S6']
df['target'] = diabetes.target
est = sm.OLS(endog=df['target'], exog=sm.add_constant(df[df.columns[0:4]])).fit()
est2 = sm.OLS(endog=df['target'], exog=sm.add_constant(df[df.columns[0:6]])).fit()
stargazer = Stargazer([est, est2]) HTML Examplestargazer.render_html()
LaTeX Examplestargazer.render_latex() |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论