mortada / fredapi

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

Get multiple series #42

Open katsuya-horiuchi opened 3 years ago

katsuya-horiuchi commented 3 years ago

If you want to get multiple series in dataframe, you have to do something like this:

df = pd.DataFrame()
for series in ['VIXCLS', 'SP500']:
    s = fred.get_series(series)
    s.name = series
    df = df.join(s, how='outer')

I wonder if we can add a method to allow you to get multiple series at once. Noticed there's a PR (#15), but seemed like it contains more than one changes.

AhmedThahir commented 1 year ago

Any updates?

Liam3851 commented 1 year ago

This is really clean and easy with a dictionary comprehension:

df = pd.DataFrame({series:fred.get_series(series) for series in ['VIXCLS', 'SP500']})
AhmedThahir commented 1 year ago

Is there a way to list all names of all series in the fred database?