get_category_series#
- FredAPI.get_category_series(category_id, realtime_start=None, realtime_end=None, limit=None, offset=None, order_by=None, sort_order=None, filter_variable=None, filter_value=None, tag_names=None, exclude_tag_names=None)[source]#
Get a FRED Category’s FRED Series
Get the series info for all series in a category from the FRED API.
- Parameters:
category_id (int) – The ID for a category.
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 1000.
offset (int, optional) – The offset for the results. Used for pagination.
order_by (str, optional) – Order results by values. Options are ‘series_id’, ‘title’, ‘units’, ‘frequency’, ‘seasonal_adjustment’, ‘realtime_start’, ‘realtime_end’, ‘last_updated’, ‘observation_start’, ‘observation_end’, ‘popularity’, ‘group_popularity’.
sort_order (str, optional) – Sort results in ascending or descending order. Options are ‘asc’ or ‘desc’.
filter_variable (str, optional) – The attribute to filter results by. Options are ‘frequency’, ‘units’, ‘seasonal_adjustment’.
filter_value (str, optional) – The value of the filter_variable to filter results by.
tag_names (str | list, optional) – A semicolon-separated list of tag names to filter results by.
exclude_tag_names (str | list, optional) – A semicolon-separated list of tag names to exclude results by.
- Returns:
If multiple series are returned.
- Return type:
List[Series]
- Raises:
ValueError – If the request to the FRED API fails or returns an error.
Example
>>> import fedfred as fd >>> fred = fd.FredAPI('your_api_key') >>> series = fred.get_category_series(125) >>> for s in series: >>> print(s.frequency) 'Quarterly' 'Annual' 'Quarterly'...
- FRED API Documentation:
https://fred.stlouisfed.org/docs/api/fred/category_series.html