PyStataR
🇬🇧 English · 🇨🇳 中文
⚠️ DEPRECATED — Superseded by StatsPAI (2026-04-14)
PyStataR is no longer maintained. All functionality has been migrated to the new package StatsPAI, which also extends its scope to a complete causal-inference and econometrics toolkit — 390+ functions covering classical econometrics, modern ML-based causal inference (DID, RDD, IV, DML, Causal Forest, Meta-Learners, TMLE, Neural Causal, Causal Discovery, Policy Learning, and more), plus publication-ready Excel / Word / LaTeX output and LLM-friendly workflows.
Migrate in 3 steps
pip install statspai
# Old (PyStataR)
from pystatar import pyegen, pywinsor2, pdtab, pyoutreg
pyegen.rowmean(df, ['x1', 'x2'])
pywinsor2.winsor2(df, ['wage'], cuts=(1, 99))
pdtab.tab2(df, 'x', 'y')
pyoutreg.outreg(model, 'out.xlsx')
# New (StatsPAI)
import statspai as sp
sp.rowmean(df, ['x1', 'x2'])
sp.winsor(df, ['wage'], cuts=(1, 99))
sp.tab(df, 'x', 'y')
sp.outreg2(model, filename='out.xlsx')
Full API mapping: see MIGRATION.md in this repository or the identical copy inside StatsPAI.
Promises to existing users
- ✅ PyPI package preserved forever —
pip install pystatarcontinues to work; existing versions will never be removed from PyPI. - ✅ GitHub repo preserved — this repository will be archived (read-only) but never deleted; all Issues, Stars, and citations remain intact.
- ❌ No new features or bug fixes — please migrate to StatsPAI for ongoing updates.
- ❌ Issues are frozen — new questions should be opened at StatsPAI/issues.
Why deprecated
PyStataR began as a Stata-to-Python bridge for the four most-used academic commands (egen, winsor2, tabulate, outreg2). Over time, the bigger vision became clear: build a Python-native, AI-era causal-inference toolbox rather than a Stata emulator. That package is StatsPAI. Running two packages in parallel only confuses users and doubles maintenance — so PyStataR's mission is being merged into StatsPAI, which does everything PyStataR did, and much more.
— Bryce Wang, 2026-04-14
Historical overview (for reference)
PyStataR was a unified interface to four mature Stata-equivalent PyPI packages:
| Submodule | Stata equivalent | Purpose |
|---|---|---|
| pyegen | egen |
Extended data generation: ranks, row statistics, group operations |
| pywinsor2 | winsor2 |
Winsorizing / trimming at percentile or IQR cutoffs |
| pdtab | tabulate |
One- and two-way cross-tabulation with statistical tests |
| pyoutreg | outreg2 |
Publication-quality regression tables exported to Excel / Word |
All four are fully covered — and substantially extended — in StatsPAI under the unified sp.* namespace.
Final version
- v0.4.1 — adds the DeprecationWarning and migration notice.
- v0.4.0 — last feature release, integrated
pyoutreg.
Citation
If you used PyStataR in a publication, you may still cite the original repository; its GitHub URL and release history will remain available indefinitely. For new work, please cite StatsPAI instead.
License
MIT — see LICENSE.
Metadata
Release files for pystatar 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pystatar-0.4.2.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pystatar-0.4.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.3 kB
Release files / pystatar-0.4.2.tar.gz
| Download URL | pystatar-0.4.2.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c024b5602494877cc7fe1cb59d9916b1a33a1f72664dbcc6d6282a5e615ddb0d
|
|
BLAKE2b-256 checksum How to use checksums |
71f0ad2f5c66d38fa34475caae354f6cbcac0bcbeaf13d1c20c1bd6c778d7000
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / pystatar-0.4.2-py3-none-any.whl
| Download URL | pystatar-0.4.2-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
19992f637d94d552e2c0aa66dc244923c9bc146916b4388536f6aa021ed6fc2b
|
|
BLAKE2b-256 checksum How to use checksums |
2f7d45671dcc192e88aa57a416f524197830f0093eee2824b6ea59e82fe7323e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|