Helpers

This module defines data classes for the FRED API responses.

class fedfred.helpers.FredHelpers[source]

Bases: object

A class that provides helper methods for the FRED API.

static datetime_conversion(param)[source]

Helper method to convert a datetime object to a string in YYYY-MM-DD format.

Return type:

str

Parameters:

param (datetime)

async static datetime_conversion_async(param)[source]

Helper method to convert a datetime object to a string in YYYY-MM-DD format asynchronously.

Return type:

str

Parameters:

param (datetime)

static datetime_hh_mm_conversion(param)[source]

Helper method to convert a datetime object to a string in HH:MM format.

Return type:

str

Parameters:

param (datetime)

async static datetime_hh_mm_conversion_async(param)[source]

Helper method to convert a datetime object to a string in HH:MM format asynchronously.

Return type:

str

Parameters:

param (datetime)

static extract_region_type(response)[source]

Helper method to extract the region type from a GeoFred response dictr.

Return type:

str

Parameters:

response (Dict)

async static extract_region_type_async(response)[source]

Helper method to extract the region type from a GeoFred response dictionary asynchronously.

Return type:

str

Parameters:

response (Dict)

static liststring_conversion(param)[source]

Helper method to convert a list of strings to a semicolon-separated string.

Return type:

str

Parameters:

param (list[str])

async static liststring_conversion_async(param)[source]

Helper method to convert a list of strings to a semicolon-separated string asynchronously.

Return type:

str

Parameters:

param (list[str])

static parameter_validation(params)[source]

Helper method to validate parameters prior to making a get request.

Return type:

Optional[ValueError]

Parameters:

params (Dict[str, str | int | None])

async static parameter_validation_async(params)[source]

Helper method to validate parameters prior to making a get request asynchronously.

Return type:

Optional[ValueError]

Parameters:

params (Dict[str, str | int | None])

static to_dd_df(data)[source]

Helper method to convert a FRED observation dictionary to a Dask DataFrame.

Return type:

DataFrame

Parameters:

data (Dict[str, list])

async static to_dd_df_async(data)[source]

Helper method to convert a FRED observation dictionary to a Dask DataFrame asynchronously.

Return type:

DataFrame

Parameters:

data (Dict[str, list])

static to_dd_gpd_gdf(shapefile, meta_data)[source]

Helper method to convert a FRED observation dictionary to a Dask GeoPandas GeoDataFrame.

Return type:

GeoDataFrame

Parameters:
async static to_dd_gpd_gdf_async(shapefile, meta_data)[source]

Helper method to convert a FRED observation dictionary to a Dask GeoPandas GeoDataFrame asynchronously.

Return type:

GeoDataFrame

Parameters:
static to_gpd_gdf(shapefile, meta_data)[source]

Helper method to convert a fred observation dictionary to a GeoPandas GeoDataFrame.

Return type:

GeoDataFrame

Parameters:
async static to_gpd_gdf_async(shapefile, meta_data)[source]

Helper method to convert a FRED observation dictionary to a GeoPandas GeoDataFrame asynchronously.

Return type:

GeoDataFrame

Parameters:
static to_pd_df(data)[source]

Helper method to convert a fred observation dictionary to a Pandas DataFrame.

Return type:

DataFrame

Parameters:

data (Dict[str, list])

async static to_pd_df_async(data)[source]

Helper method to convert a FRED observation dictionary to a Pandas DataFrame asynchronously.

Return type:

DataFrame

Parameters:

data (Dict[str, list])

static to_pl_df(data)[source]

Helper method to convert a fred observation dictionary to a Polars DataFrame.

Return type:

DataFrame

Parameters:

data (Dict[str, list])

async static to_pl_df_async(data)[source]

Helper method to convert a FRED observation dictionary to a Polars DataFrame asynchronously.

Return type:

DataFrame

Parameters:

data (Dict[str, list])

static to_pl_st_gdf(shapefile, meta_data)[source]

Helper method to convert a FRED observation dictionary to a Polars GeoDataFrame.

Return type:

GeoDataFrame

Parameters:
async static to_pl_st_gdf_async(shapefile, meta_data)[source]

Helper method to convert a FRED observation dictionary to a Polars GeoDataFrame asynchronously.

Return type:

GeoDataFrame

Parameters:
static vintage_dates_type_conversion(param)[source]
Return type:

str

Parameters:

param (str | datetime | list[str | datetime | None])

async static vintage_dates_type_conversion_async(param)[source]

Helper method to convert a vintage_dates parameter to a string asynchronously.

Return type:

str

Parameters:

param (str | datetime | list[str | datetime | None])