--- id: stanio version: "0.5.1" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # stanio — Utilities for preparing Stan inputs and processing Stan outputs License: permissive · Maintenance: active · Downloads: 6.0M/mo ## What it is and what it does StanIO is a data-wrangling utility for the Stan probabilistic programming language, handling the format conversions needed between Python and Stan. It writes Python dictionaries to Stan-compatible JSON and reads Stan's CSV output format back into numpy arrays, automatically reshaping parameters according to their declared dimensions in Stan programs. The package is primarily designed as a supporting library for cmdstanpy, the Python interface to Stan. It solves the practical problem of moving data in and out of Stan workflows without manual format handling. With numpy as its only runtime dependency and Python 3.8+ support, it integrates cleanly into existing scientific Python stacks. Use it for: - Prepare input data dictionaries for Stan models by converting them to Stan-compatible JSON format - Parse Stan CSV output files into numpy arrays with automatic parameter reshaping based on Stan declarations - Extract multi-dimensional parameters from Stan output with correct shape inference - Integrate Stan probabilistic models into Python data analysis pipelines - Serialize Python data structures for use in Stan programs without manual JSON construction ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. StanIO converts Python dictionaries to Stan-compatible JSON and reads Stan CSV output files into numpy arrays, extracting parameters according to Stan program structure. Yes, if you use Stan or cmdstanpy in Python. The package has low install friction, no known vulnerabilities, permissive licensing, and active maintenance. It solves a specific but essential problem for Stan workflows. Not relevant for projects that don't use Stan. ## Install pip install stanio uv add stanio poetry add stanio ## Installing stanio Before you install: Low friction install with a single runtime dependency (numpy). Actively maintained with recent commits; Beta status indicates ongoing development but stable enough for use. License in practice: BSD-3-Clause permissive license allows commercial and private use with minimal restrictions beyond attribution and liability disclaimer. Quickstart: pip install stanio import stanio import numpy # Convert Python dict to Stan JSON data = {'x': [1, 2, 3]} stanio.write_stan_json('input.json', data) # Read Stan CSV output into numpy array draws = stanio.read_stan_csv('output.csv') Requires Python 3.8 or later; numpy must be installed as a runtime dependency. Verify before relying: - Whether ujson integration (mentioned as optional) is automatically available or requires separate installation - Performance characteristics when handling large Stan output files or high-dimensional parameter arrays ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 6.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags stan data format conversion, stan csv output parsing, stan json serialization, probabilistic programming data wrangling, stan parameter extraction, stan input output utilities, numpy array reshaping, stan-integration, data-wrangling, probabilistic-programming [View on SkillFed](https://skillfed.io/packages/stanio) · [View on PyPI](https://pypi.org/project/stanio/)