Skip to main content

A Python library for retrieving, storing, and analyzing PPI data.

Project description

PPI Toolkit

A Python library for retrieving, storing, and analyzing Producer Price Index (PPI) data from the U.S. Bureau of Labor Statistics (BLS). The library supports:

  • Downloading BLS PPI metadata and current commodity data
  • Storing the data in a local SQLite database
  • Searching PPI data series by fuzzy matching or direct lookups
  • Computing annualized percentage changes (1-month, 3-month, 6-month, and 12-month horizons)

Features

  • Automated Data Ingestion
    Fetch metadata and commodity data directly from the BLS text files, then store them in a local SQLite database.

  • Clean, Well-Structured Database

    • metadata table for series information (e.g. series_id, group_code, series_title, etc.)
    • commodities table for monthly observations (year, period, value, etc.)
  • Fuzzy Text Search
    Quickly locate series by approximate matching on their titles.

  • Annualized Changes Calculation
    Compute monthly annualized percentage changes over 1-, 3-, 6-, and 12-month intervals.

  • Easy Plotting Hooks (Optional)
    Integration points for generating charts using matplotlib, plotly, etc.


Quickstart

Below is a minimal example of how to install and use the library:

1. Install the Library

pip install ppi-toolkit

2. Set up the database

from ppi_toolkit.database import PPIDataBase

db = PPIDataBase()
db.setup_and_import_data()
  1. Search for a series
from ppi_toolkit.search import PPISearcher

searcher = PPISearcher()  # Uses ~/ppi.db by default
results = searcher.search_titles_fuzzy("steel scrap")

for match in results:
    print(match)
    # Example output: {'series_id': 'WPS101211', 'series_title': 'Carbon steel scrap', 'score': 90}

  1. Join and analyze data
from ppi_toolkit.joiner import PPIJoiner
from ppi_toolkit.analysis import PPIAnnualizedTrends

# 1. Join data from both tables
joiner = PPIJoiner()
df_joined = joiner.get_joined_data("WPS011101")
print(df_joined.head())

# 2. Compute annualized changes
analyzer = PPIAnnualizedTrends()
df_trends = analyzer.compute_annualized_changes("WPS011101", 2018, 1, 2023, 12)
print(df_trends[["date", "value", "ann_1m", "ann_3m", "ann_6m", "ann_12m"]].tail())

License

This project is released under the MIT License. Feel free to use and modify it in personal or commercial projects, respecting the license terms.

Acknowledgements

  • Data provided courtesy of the Bureau of Labor Statistics Producer Price Index.

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

ppi_toolkit-0.2.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

ppi_toolkit-0.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ppi_toolkit-0.2.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/24.3.0

File hashes

Hashes for ppi_toolkit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7c52bd717b1984132c2805a59530aa368ef103b86dd9844d9ea1176f789efd24
MD5 6e1ca27138ab4d47c0596006dbaf5ff0
BLAKE2b-256 20707873073bf78c74fe6727cbe5f1655f5d44c1f2d9cc66fa8089576dc9aea0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ppi_toolkit-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/24.3.0

File hashes

Hashes for ppi_toolkit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a30ffd50506e43ac1a0e56139b5ab2cdccc53cee0bec512dd21073a2d66644c
MD5 72670ba3eb1c2d4b04b4e293fe4a0f67
BLAKE2b-256 e264cf49d7e470cbeb8ecb35c6dcd65542ebc2b47644178d1419c742b9928bfd

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