Jupyter kernel for Stata built on pystata
Project description
nbstata: a new Stata kernel
nbstata is a Jupyter kernel for Stata built on top of pystata.
For the User Guide, click here.
What is Jupyter?
A Jupyter notebook allows you to combine interactive code and results with Markdown in a single document. Though it is named after the three core programming languages it supports (Julia, Python, and R), it can be used with with a wide variety of languages.
nbstata allows you to create Stata notebooks (as opposed to using Stata within a Python notebook, which is needlessly clunky if you are working primarily with Stata).
Key nbstata features
- Easy setup
- Works with Stata 17+ (only).
- DataGrid widget with
browse-like capabilities (e.g., interactive filtering) - Variable and data properties available in a ‘contextual help’ side panel
- Quarto inline code support
Users of Stata 17 or 18.0 also get these features only built-in natively to Stata 18.5+:
- Displays Stata output without the redundant ‘echo’ of (multi-line) commands
- Autocompletion for variables, macros, matrices, and file paths
- Interactive/richtext help files accessible within notebook
#delimit ;interactive support (along with all types of comments)
The video below demonstrates using Stata in a Jupyter notebook. In addition to the NBClassic application shown there, nbstata can also be used with JupyterLab, VS Code, or Quarto.
What can you do with Stata notebooks…
…that you can’t do with the official Stata interface?
- Exploratory analysis that is both:
- interactive
- preserved for future reference/editing
- Present results in a way that interweaves:[^1]
- code
- results (including graphs)
- rich text:
- lists
- Headings
-
- links
- math: $y_{it}=\beta_0+\varepsilon_{it}$
Contributing
nbstata is being developed using
nbdev.
The /nbs directory is where edits to the source code should be made.
(The python code is then exported to the /nbdev library folder.)
For more, see CONTRIBUTING.md.
Acknowledgements
Kyle Barron authored the original stata_kernel, which works for older versions of Stata. Vinci Chow created a Stata kernel that instead uses pystata, which first became available with Stata 17. nbstata was originally derived from his pystata-kernel, but much of the docs and newer features are derived from stata_kernel.
[^1]: Stata dynamic documents can do this part, though with a less interactive workflow. (See also: markstat, stmd, and Statamarkdown) Using nbstata with Quarto instead gives you a similar workflow, with greater flexibility of output.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbstata-0.8.6.tar.gz.
File metadata
- Download URL: nbstata-0.8.6.tar.gz
- Upload date:
- Size: 188.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32c02e8c62dd7e640ff347e4e68b10d8b8bd41ce182cd84617ebc5ca12869ee5
|
|
| MD5 |
bea93b5cc8faa19bf1a50fda1d180f4b
|
|
| BLAKE2b-256 |
53743d0891cb8ad2ed975ff11e9c644d23617553d5e714ab96fa73d449b3d362
|
File details
Details for the file nbstata-0.8.6-py3-none-any.whl.
File metadata
- Download URL: nbstata-0.8.6-py3-none-any.whl
- Upload date:
- Size: 126.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99ed2b0207cd976ef2a798799013687e3af8d879505164d74892684276e62c91
|
|
| MD5 |
0a94c30f7cd28d6159396c5e7e80878f
|
|
| BLAKE2b-256 |
8274fb1eaf11d6879e5548af504b966771721381c939d62b03210f3931dc5a9b
|