Pull BEA API

EnergyIntensityIndicators.pull_bea_api.BEA_api

class EnergyIntensityIndicators.pull_bea_api.BEA_api(years)

Bases: object

class for calling gross output and quantity index values

static adjust_transportation(qty_index, nominal_data)

Method to adjust transportation data in Industrial Sector

call_api(params)

Method for calling BEA api for given range of years [min, max]

Parameters
  • years (list) – List of begnning year and ending year of data to retrieve from BEA API.

  • params (dict) – Dictionary of DataSetName and tableID.

Returns

data – Dataframe of results. Will print API error, if applicable.

Return type

dataframe

chain_qty_indexes()

Merge historical and api data, manipulate as in ChainQtyIndexes

collect_go(historical_data)

Method to collect gross output data

collect_va(historical_data)

Method to collect value added data

format_data(data)

format and pivot called data

get_data(table_name)

Get data using the BEA API call.

Parameters
  • years (list) – List of begnning year and ending year of data to retrieve from BEA API.

  • table_name (str) – go_quant_index (Industry Gross Output, quantity indexes), go_nominal (Industry Gross Output, nominal), va_nominal (Industry Value Added, nominal), va_quant_index (Industry Value Added, quanitity indexes). Additional values can be added with their corresponding tableID number to tableID_dict

Returns

data – Dataframe of BEA data.

Return type

dataframe

import_historical()

Method for importing historical BEA data, saved as csv Footnotes: 1. Consists of agriculture, forestry, fishing, and hunting; mining; construction; and manufacturing. 2. Consists of utilities; wholesale trade; retail trade; transportation and warehousing; information; finance, insurance, real estate, rental, and leasing; professional and business services; educational services, health care, and social assistance; arts, entertainment, recreation, accommodation, and food services; and other services, except government. 3. Consists of computer and electronic product manufacturing (excluding navigational, measuring, electromedical, and control instruments manufacturing); software publishers; broadcasting and telecommunications; data processing, hosting and related services; internet publishing and broadcasting and web search portals; and computer systems design and related services.

static laspeyres_quantity(nominal_data, quantity_index)

Calculate Laspeyres quantity

static merge_historical(api_data, historical)

Merge all historical data into one dataframe

static pasche_quantity(nominal_data, quantity_index)

Calculate Pasche quantity

transform_data(nominal_historical, nominal_from_api, qty_index_historical, qty_index_from_api)

Format data