mortada / fredapi

Python API for FRED (Federal Reserve Economic Data) and ALFRED (Archival FRED)
Apache License 2.0
902 stars 159 forks source link

fredapi cannot load in the gdp output gap data. #43

Open chungs123 opened 2 years ago

chungs123 commented 2 years ago

the dataset I cannot load is called:

100*(Real Gross Domestic Product-Real Potential Gross Domestic Product)/Real Potential Gross Domestic Product

Liam3851 commented 2 years ago

fredapi gets the data from Fred, it doesn't do calculations, for that use pandas.

The actual series are called GDPC1 and GDPPOT, as you can see on the webpage where you found that data.

So your calculation is

100 * (fred.get_series('GDPC1') - fred.get_series('GDPPOT')) / fred.get_series('GDPPOT')
chungs123 commented 2 years ago

fredapi gets the data from Fred, it doesn't do calculations, for that use pandas.

The actual series are called GDPC1 and GDPPOT, as you can see on the webpage where you found that data.

So your calculation is

100 * (fred.get_series('GDPC1') - fred.get_series('GDPPOT')) / fred.get_series('GDPPOT')

I've tried printing that code, but it says "NaN" as an output because the GDPPOT dataset is giving me data that doesn't correspond with the data in GDPC1. Is there any way to sync the date from GDPPOT to GDPC1?

or to perhaps load from: https://fred.stlouisfed.org/graph/?g=f1cZ

thank you! (im new to python please bear with me. this is my 3rd day coding)

Liam3851 commented 2 years ago

This site (Github) is for bug reports (reporting that the software functionality is incorrect or not as expected). The questions you have would be better answered by referring to the pandas documentation and perhaps Stack Overflow as they are not related to problems with fredapi.

chungs123 commented 2 years ago

I tried again and I'm getting a value of -16% for potential gdp, but the problem is that potential gdp goes out an extra 10 years, and fredapi uses the latest date. I've been trying to make a workaround using datetime, but I can't figure out a way to make it work. Is there anything I can do for this particular dataset?