A comprehensive Python library for robust macroeconomic data transformation, analysis, and visualization.
Project description
stats-transformer
stats-transformer is a Python library for macroeconomic data transformation, analysis, and visualization. Built around a configuration-driven architecture, it handles data ingestion, resampling, feature engineering, and econometric modeling for time-series and panel datasets.
Features
- Feature Engineering: Advanced data transformations, frequency alignment, and robust merging capabilities for disparate datasets.
- Econometric Modeling: Built-in support for standard OLS, Robust OLS, Panel Regression, IV regression, discrete choice, time-series models, and unsupervised learning models (PCA, KMeans).
- Visualization: Automated generation of Exploratory Data Analysis (EDA) and regression model visual summaries (e.g., coefficient plots, residual plots, time-series tracking). Now includes a modular suite of standalone chart components for custom research plots.
- Configuration-Driven Orchestration: Fully integrated with YAML configuration (
params.yaml) to enable reproducible, stage-based execution compatible with DVC pipelines.
Quickstart
1. Installation
To use it in your project via PyPI:
uv add stats-transformer
For local development from this repository:
uv sync
2. Configuration (params.yaml)
Define your data sources, pipeline parameters, and model specifications in a params.yaml file:
data:
featurization:
entity_column: country
datasets:
- name: macro_data
path: data/raw/macro_indicators.csv
frequency: Q
model:
model_type: panel_ols
target_variable: gdp_growth
independent_variables:
- interest_rate
- inflation
visualization:
output_dir: reports/visualizations
3. Usage
Load a packaged example dataset:
from stats_transformer.data import list_examples, load_example
print(list_examples())
df = load_example("macrodb_gdp_inflation")
You can execute the pipeline via the command line using the Pipeline orchestrator:
# Run the full end-to-end pipeline
uv run python -m stats_transformer.pipeline --config params.yaml
Or you can interact with the API programmatically:
from stats_transformer import Pipeline
# Initialize the pipeline with your configuration
pipeline = Pipeline(params_path="params.yaml")
# Run specific stages sequentially
merged_data = pipeline.run(stage="resample")
transformed_data = pipeline.run(stage="features")
model_results = pipeline.run(stage="regression")
# Generate and save visualizations
pipeline.run(stage="visualization")
4. Testing
Verify the installation and library integrity by running the test suite:
uv run pytest tests
For more details on test coverage, see the Testing Suite.
Documentation
- Examples: For examples of running the models, see docs/validation/academic_examples.md.
- Visualization Walkthrough: For a guide on using the modular chart components, see notebooks/07_chart_components.ipynb.
- System Design: For more details on the system design, see docs/library/architecture.md.
- File Structure: For the standardized research folder structure, see docs/library/file_structure.md.
- Validation & Testing: For details on the testing suite, see docs/validation/testing_suite.md.
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 stats_transformer-1.2.0.tar.gz.
File metadata
- Download URL: stats_transformer-1.2.0.tar.gz
- Upload date:
- Size: 250.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8834cbb547277b4e21c436bf9a46637b4b3e9bd7237b872ec43cfe65b2af0b03
|
|
| MD5 |
c823c67f13c76f6e1487bd7ec8b3722f
|
|
| BLAKE2b-256 |
f35e3026a74b10ef1b0c65a4d76f408e52d021c86c94c156c898c55fc327db51
|
Provenance
The following attestation bundles were made for stats_transformer-1.2.0.tar.gz:
Publisher:
publish.yml on corybaird/stats-transformer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stats_transformer-1.2.0.tar.gz -
Subject digest:
8834cbb547277b4e21c436bf9a46637b4b3e9bd7237b872ec43cfe65b2af0b03 - Sigstore transparency entry: 1838394893
- Sigstore integration time:
-
Permalink:
corybaird/stats-transformer@f6d8df9ed1c7ad4428600658bf32c9cc984f7879 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/corybaird
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f6d8df9ed1c7ad4428600658bf32c9cc984f7879 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stats_transformer-1.2.0-py3-none-any.whl.
File metadata
- Download URL: stats_transformer-1.2.0-py3-none-any.whl
- Upload date:
- Size: 263.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7251d987037937fccd785e75f1d3c702013ec002431560dfb488adf93044b435
|
|
| MD5 |
7ab01fa3d94d5781d3389b0bb73bfe49
|
|
| BLAKE2b-256 |
f44eee4b7d023bb926d1d7a358e9428befbfe96415abfe9afc612137498c27a4
|
Provenance
The following attestation bundles were made for stats_transformer-1.2.0-py3-none-any.whl:
Publisher:
publish.yml on corybaird/stats-transformer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stats_transformer-1.2.0-py3-none-any.whl -
Subject digest:
7251d987037937fccd785e75f1d3c702013ec002431560dfb488adf93044b435 - Sigstore transparency entry: 1838395247
- Sigstore integration time:
-
Permalink:
corybaird/stats-transformer@f6d8df9ed1c7ad4428600658bf32c9cc984f7879 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/corybaird
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f6d8df9ed1c7ad4428600658bf32c9cc984f7879 -
Trigger Event:
push
-
Statement type: