maketables 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Alexander Fischer, Dirk Sliwka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,30 @@
1
+ # Include important files in the package distribution
2
+ include README.md
3
+ include LICENSE
4
+ include requirements.txt
5
+ include requirements-dev.txt
6
+
7
+ # Include documentation
8
+ recursive-include docs *
9
+ prune docs/_build
10
+
11
+ # Include data files if any
12
+ recursive-include maketables *.txt
13
+ recursive-include maketables *.md
14
+ recursive-include data *.dta
15
+
16
+ # Exclude unnecessary files
17
+ global-exclude *.pyc
18
+ global-exclude *.pyo
19
+ global-exclude __pycache__
20
+ global-exclude .pytest_cache
21
+ global-exclude .DS_Store
22
+ global-exclude *.so
23
+ global-exclude .coverage
24
+ exclude .gitignore
25
+
26
+ # Exclude notebooks and test files from distribution
27
+ exclude *.ipynb
28
+ exclude test_*.ipynb
29
+ prune test*
30
+ prune *test*
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.4
2
+ Name: maketables
3
+ Version: 0.1.4
4
+ Summary: A Python package for creating publication-ready tables from regression results (statsmodels, pyfixest, linearmodels), descriptive statistics, and balance tables with output to LaTeX, Word, and HTML/Great Tables
5
+ Author-email: Alexander Fischer <alexander-fischer1801@t-online.de>, Dirk Sliwka <dirk.sliwka@uni-koeln.de>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/py-econometrics/maketables
8
+ Project-URL: Documentation, https://py-econometrics.github.io/maketables/
9
+ Project-URL: Repository, https://github.com/py-econometrics/maketables
10
+ Project-URL: Issues, https://github.com/py-econometrics/maketables/issues
11
+ Keywords: tables,statistics,regression,econometrics,latex,publication,pyfixest,statsmodels
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: numpy>=1.20.0
26
+ Requires-Dist: pandas>=1.3.0
27
+ Requires-Dist: great-tables>=0.2.0
28
+ Requires-Dist: tabulate>=0.9.0
29
+ Requires-Dist: python-docx>=0.8.11
30
+ Requires-Dist: ipython>=7.0.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.0; extra == "dev"
33
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
34
+ Requires-Dist: black>=22.0; extra == "dev"
35
+ Requires-Dist: flake8>=5.0; extra == "dev"
36
+ Requires-Dist: mypy>=1.0; extra == "dev"
37
+ Requires-Dist: pre-commit<5,>=4.3.0; extra == "dev"
38
+ Requires-Dist: quartodoc>=0.7.0; extra == "dev"
39
+ Provides-Extra: docs
40
+ Requires-Dist: sphinx>=5.0; extra == "docs"
41
+ Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
42
+ Requires-Dist: pyfixest>=0.13.0; extra == "docs"
43
+ Requires-Dist: statsmodels>=0.13.0; extra == "docs"
44
+ Requires-Dist: ipykernel<7,>=6.0.0; extra == "docs"
45
+ Requires-Dist: nbconvert>=7.0.0; extra == "docs"
46
+ Requires-Dist: pylatex<2,>=1.4.2; extra == "docs"
47
+ Requires-Dist: pyyaml<7,>=6.0.0; extra == "docs"
48
+ Provides-Extra: pystata
49
+ Requires-Dist: pystata>=0.0.1; extra == "pystata"
50
+ Requires-Dist: stata-setup>=0.1.0; extra == "pystata"
51
+ Dynamic: license-file
52
+
53
+ # MakeTables
54
+
55
+ A Python package for creating publication-ready tables from regression results (statsmodels, pyfixest, linearmodels), descriptive statistics, and balance tables with output to LaTeX, Word, and HTML via Great Tables. To get started, check out the [Getting Started Notebook](getting-started.ipynb).
56
+
57
+ ## Overview
58
+
59
+ MakeTables provides a unified interface for generating tables such as:
60
+
61
+ - Regression tables from [Statsmodels](https://www.statsmodels.org/stable/index.html), [PyFixest](https://py-econometrics.github.io/pyfixest/pyfixest.html), [Linearmodels](https://bashtage.github.io/linearmodels/) and [Stata](https://www.stata.com/python/pystata19/)
62
+ - Descriptive statistics
63
+ - Balance tables
64
+
65
+ The package supports multiple output formats including:
66
+
67
+ - Great Tables (HTML)
68
+ - LaTeX
69
+ - Microsoft Word (docx) documents
70
+
71
+ ## Origin
72
+
73
+ MakeTables originated as the table output functionality within the [pyfixest](https://github.com/py-econometrics/pyfixest) package and has been moved to this standalone package to provide broader table creation capabilities also supporting other statistical packages.
74
+
75
+ ## Authors
76
+
77
+ - Alexander Fischer [https://github.com/s3alfischer](https://github.com/s3alfisc)
78
+ - Dirk Sliwka [https://dsliwka.github.io/](https://dsliwka.github.io)
79
+
80
+ ## Installation
81
+
82
+ ### From PyPI (when published)
83
+ ```bash
84
+ pip install maketables
85
+ ```
86
+
87
+ ### Development Installation
88
+ ```bash
89
+ # Clone the repository
90
+ git clone https://github.com/yourusername/maketables.git
91
+ cd maketables
92
+
93
+ # Install in development mode
94
+ pip install -e .
95
+ ```
96
+
97
+ ## Quick Start
98
+
99
+ ### Descriptive Statistics Table
100
+
101
+ ```python
102
+ import pandas as pd
103
+ import maketables as mt
104
+
105
+ # Load your data (here using a sample Stata dataset with the import_dta function that also stores variable labels)
106
+ df = mt.import_dta("https://www.stata-press.com/data/r18/auto.dta")
107
+
108
+
109
+ # Create descriptive statistics table
110
+ mt.DTable(df, vars=["mpg","weight","length"], bycol=["foreign"])
111
+ ```
112
+
113
+ ### Regression Tables
114
+
115
+ #### with pyfixest
116
+ ```python
117
+ import pyfixest as pf
118
+
119
+ # Fit your models here using pyfixest
120
+ est1 = pf.feols("mpg ~ weight", data=df)
121
+ est2 = pf.feols("mpg ~ weight + length", data=df)
122
+
123
+ # Make the table
124
+ mt.ETable([est1, est2])
125
+ ```
126
+
127
+ #### with statsmodels
128
+ ```python
129
+ import statsmodels.formula.api as smf
130
+
131
+ # Generate a dummy variable and label it
132
+ df["foreign_i"] = (df["foreign"] == "Foreign")*1
133
+ mt.set_var_labels(df, {"foreign_i": "Foreign (indicator)"})
134
+
135
+ # Fit your models
136
+ est1 = smf.ols("foreign_i ~ weight + length + price", data=df).fit()
137
+ est2 = smf.probit("foreign_i ~ weight + length + price", data=df).fit(disp=0)
138
+
139
+ # Make the table
140
+ mt.ETable([est1, est2], model_stats=["N","r2","pseudo_r2",""], model_heads=["OLS","Probit"])
141
+ ```
142
+
143
+
144
+ ## Main Classes
145
+
146
+ ### `MTable`
147
+ Base class for all table types with common functionality:
148
+ - Multiple output formats (Great Tables, LaTeX, Word)
149
+ - Flexible styling and formatting options
150
+ - Save and export capabilities
151
+ - Can also update tables in existing word documents
152
+ - 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)
153
+
154
+
155
+ ### `DTable`
156
+ Extends MTable for descriptive statistics:
157
+ - Automatic calculation of summary statistics
158
+ - Grouping by categorical variables (rows and columns)
159
+ - Customizable statistic labels and formatting
160
+
161
+ ### `ETable`
162
+ Extends MTable for econometric model results:
163
+ - Support for statsmodels, pyfixest, and (more experimental) linearmodels
164
+ - Many layout options (relabelling of variables, keep/drop, choice of reported statistics, column headings,...)
165
+
166
+ ### `BTable`
167
+ Extends MTable for simple balance tables.
168
+
169
+
170
+ ## License
171
+
172
+ This project is licensed under the MIT License - see the LICENSE file for details.
173
+
174
+
175
+ ## Acknowledgments
176
+
177
+ - Built on the excellent [pyfixest](https://github.com/py-econometrics/pyfixest) package for econometric models
178
+ - Uses [Great Tables](https://github.com/posit-dev/great-tables) for beautiful HTML table output
@@ -0,0 +1,126 @@
1
+ # MakeTables
2
+
3
+ A Python package for creating publication-ready tables from regression results (statsmodels, pyfixest, linearmodels), descriptive statistics, and balance tables with output to LaTeX, Word, and HTML via Great Tables. To get started, check out the [Getting Started Notebook](getting-started.ipynb).
4
+
5
+ ## Overview
6
+
7
+ MakeTables provides a unified interface for generating tables such as:
8
+
9
+ - Regression tables from [Statsmodels](https://www.statsmodels.org/stable/index.html), [PyFixest](https://py-econometrics.github.io/pyfixest/pyfixest.html), [Linearmodels](https://bashtage.github.io/linearmodels/) and [Stata](https://www.stata.com/python/pystata19/)
10
+ - Descriptive statistics
11
+ - Balance tables
12
+
13
+ The package supports multiple output formats including:
14
+
15
+ - Great Tables (HTML)
16
+ - LaTeX
17
+ - Microsoft Word (docx) documents
18
+
19
+ ## Origin
20
+
21
+ MakeTables originated as the table output functionality within the [pyfixest](https://github.com/py-econometrics/pyfixest) package and has been moved to this standalone package to provide broader table creation capabilities also supporting other statistical packages.
22
+
23
+ ## Authors
24
+
25
+ - Alexander Fischer [https://github.com/s3alfischer](https://github.com/s3alfisc)
26
+ - Dirk Sliwka [https://dsliwka.github.io/](https://dsliwka.github.io)
27
+
28
+ ## Installation
29
+
30
+ ### From PyPI (when published)
31
+ ```bash
32
+ pip install maketables
33
+ ```
34
+
35
+ ### Development Installation
36
+ ```bash
37
+ # Clone the repository
38
+ git clone https://github.com/yourusername/maketables.git
39
+ cd maketables
40
+
41
+ # Install in development mode
42
+ pip install -e .
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ### Descriptive Statistics Table
48
+
49
+ ```python
50
+ import pandas as pd
51
+ import maketables as mt
52
+
53
+ # Load your data (here using a sample Stata dataset with the import_dta function that also stores variable labels)
54
+ df = mt.import_dta("https://www.stata-press.com/data/r18/auto.dta")
55
+
56
+
57
+ # Create descriptive statistics table
58
+ mt.DTable(df, vars=["mpg","weight","length"], bycol=["foreign"])
59
+ ```
60
+
61
+ ### Regression Tables
62
+
63
+ #### with pyfixest
64
+ ```python
65
+ import pyfixest as pf
66
+
67
+ # Fit your models here using pyfixest
68
+ est1 = pf.feols("mpg ~ weight", data=df)
69
+ est2 = pf.feols("mpg ~ weight + length", data=df)
70
+
71
+ # Make the table
72
+ mt.ETable([est1, est2])
73
+ ```
74
+
75
+ #### with statsmodels
76
+ ```python
77
+ import statsmodels.formula.api as smf
78
+
79
+ # Generate a dummy variable and label it
80
+ df["foreign_i"] = (df["foreign"] == "Foreign")*1
81
+ mt.set_var_labels(df, {"foreign_i": "Foreign (indicator)"})
82
+
83
+ # Fit your models
84
+ est1 = smf.ols("foreign_i ~ weight + length + price", data=df).fit()
85
+ est2 = smf.probit("foreign_i ~ weight + length + price", data=df).fit(disp=0)
86
+
87
+ # Make the table
88
+ mt.ETable([est1, est2], model_stats=["N","r2","pseudo_r2",""], model_heads=["OLS","Probit"])
89
+ ```
90
+
91
+
92
+ ## Main Classes
93
+
94
+ ### `MTable`
95
+ Base class for all table types with common functionality:
96
+ - Multiple output formats (Great Tables, LaTeX, Word)
97
+ - Flexible styling and formatting options
98
+ - Save and export capabilities
99
+ - Can also update tables in existing word documents
100
+ - 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)
101
+
102
+
103
+ ### `DTable`
104
+ Extends MTable for descriptive statistics:
105
+ - Automatic calculation of summary statistics
106
+ - Grouping by categorical variables (rows and columns)
107
+ - Customizable statistic labels and formatting
108
+
109
+ ### `ETable`
110
+ Extends MTable for econometric model results:
111
+ - Support for statsmodels, pyfixest, and (more experimental) linearmodels
112
+ - Many layout options (relabelling of variables, keep/drop, choice of reported statistics, column headings,...)
113
+
114
+ ### `BTable`
115
+ Extends MTable for simple balance tables.
116
+
117
+
118
+ ## License
119
+
120
+ This project is licensed under the MIT License - see the LICENSE file for details.
121
+
122
+
123
+ ## Acknowledgments
124
+
125
+ - Built on the excellent [pyfixest](https://github.com/py-econometrics/pyfixest) package for econometric models
126
+ - Uses [Great Tables](https://github.com/posit-dev/great-tables) for beautiful HTML table output