fusetools.research_tools.Economics

class fusetools.research_tools.Economics[source]

Bases: object

Functions for dealing with Economic data sources.

Methods

bea_gdp

Performs a query against the BEA API.

bls_query

Retrieves Consumer Price Index figures from the Bureau of Labor Statistics API.

bls_query_lookup

Executes a series of queries against the BLS database using a DataFrame of lookups.

classmethod bea_gdp(api_key, tbl_name='SQGDP1')[source]

Performs a query against the BEA API.

Parameters
  • api_key – BEA API.

  • tbl_name – Name of data table to query from BEA database.

Returns

Pandas DataFrame of responses.

classmethod bls_query(series_id, start_year, end_year, api_key)[source]

Retrieves Consumer Price Index figures from the Bureau of Labor Statistics API.

Parameters
  • series_id – Unique ID for a geography and an economic measure.

  • start_year – Starting year for query.

  • end_year – Ending year for query.

  • api_key – API key for BLS.

Returns

JSON response for API call.

classmethod bls_query_lookup(lookup_df, lookup_area_type, start_year, end_year, api_keys)[source]

Executes a series of queries against the BLS database using a DataFrame of lookups.

Parameters
  • lookup_df – Pandas DataFrame of BLS lookup codes.

  • lookup_area_type – Type of area to lookup data for.

  • start_year – Starting year for query.

  • end_year – Ending year for query.

  • api_keys – API key for BLS.

Returns

Pandas DataFrame of responses for all queried lookup codes.