Skip to content
ryansherby edited this page Jan 13, 2023 · 8 revisions

Welcome to the BLS-Transformer wiki!

Getting Started

Import Module

from bls_transformer import BLS

Initialize Module

bls = BLS.API(series_id=[<YOUR SERIES ID(S)>],*)

Converting Data

To show the raw JSON dictionary, use bls.json_response. Otherwise, proceed with the command bls.transform_json() to initialize the data dictionary.

Accessing the Data

Get DataFrame

df = bls.get_DataFrame(id=[<YOUR SERIES ID(S)>],index=[<INDEX(S)>],catalog_value=None,axis=1)
  • Returns a DataFrame concatenated on the Series ID of each individual DataFrame.
  • A DataFrame's index is the same as the order in which the Series it corresponds to was initialized, starting at zero.
  • The catalog_value chosen will replace the Series ID for each individual DataFrame.
  • The axis represents the direction the aggregate DataFrame will be concatenated on. 0 is vertical (index), 1 is horizontal (columns).
  • The first DataFrame requested will always possess the 'Period' key concatenated on. This will lead to odd results if DataFrames with different periods (e.g., monthly/quarterly) are concatenated within the same get_DataFrame() request.

Get Catalog

catalog = bls.get_catalog(id=[<YOUR SERIES ID(S)>],index=[<INDEX(S)>])
  • Returns a list of JSON dictionaries containing information about the requested Series.
  • A catalog's index is the same as the order in which the Series it corresponds to was initialized, starting at zero.