get_shape_files#

MapsAPI.get_shape_files(shape, geodataframe_method='geopandas')#

Get GeoFRED shape files

This request returns shape files from FRED in GeoJSON format.

Parameters:
  • shape (str, required) – The type of shape you want to pull GeoJSON data for. Available Shape Types: ‘bea’ (Bureau of Economic Anaylis Region), ‘msa’ (Metropolitan Statistical Area), ‘frb’ (Federal Reserve Bank Districts), ‘necta’ (New England City and Town Area), ‘state’, ‘country’, ‘county’ (USA Counties), ‘censusregion’ (US Census Regions), ‘censusdivision’ (US Census Divisons).

  • geodataframe_method (str, optional) – The method to use for creating the GeoDataFrame. Options are ‘geopandas’, ‘dask’ or ‘polars’. Default is ‘geopandas’.

Returns:

If dataframe_method is ‘geopandas’. Dask GeoPandas GeoDataframe: If dataframe_method is ‘dask’. Polars GeoDataframe: If dataframe_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
>>> shapefile = fred.get_shape_files('state')
>>> print(shapefile.head())
                                            geometry  ...   type
0  MULTIPOLYGON (((9727 7650, 10595 7650, 10595 7...  ...  State
1  MULTIPOLYGON (((-77 9797, -56 9768, -91 9757, ...  ...  State
2  POLYGON ((-833 8186, -50 7955, -253 7203, 32 6...  ...  State
3  POLYGON ((-50 7955, -833 8186, -851 8223, -847...  ...  State
4  MULTIPOLYGON (((6206 8297, 6197 8237, 6159 815...  ...  State
[5 rows x 20 columns]
FRED API Documentation:

https://fred.stlouisfed.org/docs/api/geofred/shapes.html