Open ghost opened 7 years ago
what error do you get?
Well, it just does not work when I do what I commented: the columns don't show up.
On Jul 4, 2017 8:07 PM, "Mortada Mehyar" notifications@github.com wrote:
what error do you get?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mortada/fredapi/issues/19#issuecomment-312968856, or mute the thread https://github.com/notifications/unsubscribe-auth/AP7npoQsIcQtsZT8GpEbV97os89VDJBRks5sKtO-gaJpZM4OMnRc .
@joshash I think the easiest would be a DataFrame, I think. For example, the following would put a DataFrame with your descriptions as the column names, and then write the result out to Excel:
values = pd.DataFrame({description:fred.get_series(id, observation_start='1/1/2012') for id, description in data_list})
values.to_excel('/Fred_Data.xlsx', sheet_name='FRED Data')
If you really want the data in different sheets (why?) then replace values.to_excel call in your example with
values.to_frame().rename(columns={0:description}).to_excel(...)
I suggest referring at the Pandas documentation for more about Series and DataFrame.
Basically, I am having trouble writing columns to an Excel file from a series in Fred. My issue is in the last line of the dataget function, where I have tried many things, and each give an error.