Skip to main content

Numerical economics and research utilities.

Project description

PyTools

py_tools is a research-oriented Python toolkit for numerical economics, time series, estimation, and dataset loading utilities.

Installation

Install from PyPI:

pip install dgreenwald-py-tools

Or clone the repository and install in editable mode:

pip install -e .

Optional extras:

pip install "dgreenwald-py-tools[ml]"        # scikit-learn, patsy
pip install "dgreenwald-py-tools[datasets]"  # pandas-datareader, python-dotenv
pip install "dgreenwald-py-tools[scraping]"  # requests, beautifulsoup4, lxml
pip install "dgreenwald-py-tools[nlp]"       # nltk
pip install "dgreenwald-py-tools[mpi]"       # mpi4py
pip install "dgreenwald-py-tools[dev]"       # pytest, ruff

If you use dataset loaders, set:

export PY_TOOLS_DATA_DIR=/path/to/data

Or create a .env file in the repository root (or a parent directory):

PY_TOOLS_DATA_DIR=/path/to/data

py_tools.datasets will load .env automatically when python-dotenv is installed (included in the datasets extra).

Quick Start

from py_tools import data, time_series, state_space

# Example: call a utility function from a core module
# (see module docstrings/source for full APIs)

You can also import dataset loaders through:

from py_tools import datasets

available = datasets.list_datasets()
df = datasets.load_dataset("fred", codes=["UNRATE"])

Module Overview

Import path Contents
py_tools.time_series Kalman filter, state-space models, VAR/BVAR, HMMs
py_tools.econometrics NLS/GMM, bootstrap, local projections, high-dimensional FE
py_tools.bayesian MCMC sampling, prior distributions
py_tools.numerical Root-finding, Chebyshev approximation
py_tools.datasets Loaders for ~38 economic data sources
py_tools.data Data manipulation, aggregation, matching
py_tools.econ Discrete choice, yield curves, AIM solver
py_tools.plot Plotting utilities
py_tools.config Named model specification registry
py_tools.scraping HTML scraping and text utilities
py_tools.compute MPI array distribution

Development

pip install -e ".[dev]"
python -m pytest          # run tests
ruff check .              # lint

Contributing

  • Keep changes focused and commit one logical change at a time.
  • Follow repository coding and workflow guidelines in AGENTS.md.
  • Prefer adding deterministic tests in tests/ for new behavior.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dgreenwald_py_tools-0.2.0.tar.gz (272.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dgreenwald_py_tools-0.2.0-py3-none-any.whl (276.2 kB view details)

Uploaded Python 3

File details

Details for the file dgreenwald_py_tools-0.2.0.tar.gz.

File metadata

  • Download URL: dgreenwald_py_tools-0.2.0.tar.gz
  • Upload date:
  • Size: 272.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for dgreenwald_py_tools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8170d1fd46f2014f28fd99a26a0bae83a3c0739ac01e667ceba352d1872cf492
MD5 bc21efb684587d4dd88f9e16ca886d0e
BLAKE2b-256 dc14271820bc29636754a3aa0801b2cb32ac86877fa8feb7e045e518cf1a3019

See more details on using hashes here.

File details

Details for the file dgreenwald_py_tools-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dgreenwald_py_tools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d531b6a761da26eb98bf09d14ac96dc1be046da6d467304ada1118073f32b829
MD5 aae0a449749432a3add51f19628a84a0
BLAKE2b-256 503df236fd8b1d0cf1f749fa2ec9b60266bf205ff383386de3dd9d9f4b2407bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page