get_series_observations#

async AsyncAPI.get_series_observations(series_id, dataframe_method='pandas', realtime_start=None, realtime_end=None, limit=None, offset=None, sort_order=None, observation_start=None, observation_end=None, units=None, frequency=None, aggregation_method=None, output_type=None, vintage_dates=None)#

Get FRED series observations

Get observations for a FRED series as a pandas or polars DataFrame.

Parameters:
  • series_id (str) – The ID for a series.

  • dataframe_method (str, optional) – The method to use to convert the response to a DataFrame. Options: ‘pandas’, ‘polars’, or ‘dask’. Default is ‘pandas’.

  • realtime_start (str | datetime, optional) – The start of the real-time period. String format: YYYY-MM-DD.

  • realtime_end (str | datetime, optional) – The end of the real-time period. String format: YYYY-MM-DD.

  • limit (int, optional) – The maximum number of results to return. Default is 100000.

  • offset (int, optional) – The offset for the results. Used for pagination.

  • sort_order (str, optional) – Sort results by observation date. Options: ‘asc’, ‘desc’.

  • observation_start (str | datetime, optional) – The start of the observation period. String format: YYYY-MM-DD.

  • observation_end (str | datetime, optional) – The end of the observation period. String format: YYYY-MM-DD.

  • units (str, optional) – A key that indicates a data transformation. Options: ‘lin’, ‘chg’, ‘ch1’, ‘pch’, ‘pc1’, ‘pca’, ‘cch’, ‘cca’, ‘log’.

  • frequency (str, optional) – An optional parameter to change the frequency of the observations. Options: ‘d’, ‘w’, ‘bw’, ‘m’, ‘q’, ‘sa’, ‘a’, ‘wef’, ‘weth’, ‘wew’, ‘wetu’, ‘wem’, ‘wesu’, ‘wesa’, ‘bwew’, ‘bwem’.

  • aggregation_method (str, optional) – A key that indicates the aggregation method used for frequency aggregation. Options: ‘avg’, ‘sum’, ‘eop’.

  • output_type (int, optional) – An integer indicating the type of output. Options: 1 (observations by realtime period), 2 (observations by vintage date, all observations), 3 (observations by vintage date, new and revised observations only), 4 (observations by initial release only).

  • vintage_dates (str | list, optional) – A comma-separated string of vintage dates. String format: YYYY-MM-DD.

Returns:

If dataframe_method=’pandas’ or is left blank. Polars DataFrame: If dataframe_method=’polars’. Dask DataFrame: If dataframe_method=’dask’.

Return type:

Pandas DataFrame

Raises:

ValueError – If the API request fails or returns an error.

Example

>>> import fedfred as fd
>>> import asyncio
>>> async def main():
>>>     fred = fd.FredAPI('your_api_key').Async
>>>     observations = fred.get_series_observations('GNPCA')
>>>     print(observations.head())
>>> asyncio.run(main())
date       realtime_start realtime_end     value
1929-01-01     2025-02-13   2025-02-13  1202.659
1930-01-01     2025-02-13   2025-02-13  1100.670
1931-01-01     2025-02-13   2025-02-13  1029.038
1932-01-01     2025-02-13   2025-02-13   895.802
1933-01-01     2025-02-13   2025-02-13   883.847
FRED API Documentation:

https://fred.stlouisfed.org/docs/api/fred/series_observations.html