get_series_data#
- MapsAPI.get_series_data(series_id, geodataframe_method='geopandas', date=None, start_date=None)#
Get GeoFRED series data
This request returns a cross section of regional data for a specified release date. If no date is specified, the most recent data available are returned.
- Parameters:
series_id (string, required) – The FRED series_id you want to request maps data for. Not all series that are in FRED have geographical data.
geodataframe_method (str, optional) – The method to use for creating the GeoDataFrame. Options are ‘geopandas’ ‘polars’, or ‘dask’. Default is ‘geopandas’.
date (string | datetime, optional) – The date you want to request series group data from. String format: YYYY-MM-DD
start_date (string | datetime, optional) – The start date you want to request series group data from. This allows you to pull a range of data. String format: YYYY-MM-DD
- Returns:
If geodataframe_method is ‘geopandas’. Dask GeoPandas GeoDataframe: If geodataframe_method is ‘dask’. Polars GeoDataframe: If geodataframe_method is ‘polars’.
- Return type:
GeoPandas GeoDataframe
- Raises:
ValueError – If the API request fails or returns an error.
Example
>>> import fedfred as fd >>> fred = fd.FredAPI('your_api_key').Maps >>> series_data = fred.get_series_data('SMU56000000500000001') >>> print(series_data.head()) name geometry ... series_id Washington MULTIPOLYGON (((-77 9797, -56 9768, -91 9757, ... ... SMU53000000500000001 California POLYGON ((-833 8186, -50 7955, -253 7203, 32 6... ... SMU06000000500000001 Oregon POLYGON ((-50 7955, -833 8186, -851 8223, -847... ... SMU41000000500000001 Wisconsin MULTIPOLYGON (((6206 8297, 6197 8237, 6159 815... ... SMU55000000500000001
- FRED API Documentation:
https://fred.stlouisfed.org/docs/api/geofred/series_data.html