0

I'm trying to write a dataframe (from zipline pickle) to excel, but so far it's not working as usual (for dataframes). Suggestions would be greatly appreciated!

writer = pd.ExcelWriter('output.xlsx')

backtest_df.to_excel(writer,'sheet1')

writer.save()

With the following error:

KeyError: class 'pandas._libs.tslib.Timestamp'

Tom M
  • 3
  • 1
  • 2
  • could you post an example of the dataframe? Also, did you try changing it to a pandas df before calling writer on it? – d_kennetz Aug 30 '18 at 14:24

1 Answers1

0

Try downgrading your openpyxl package to 2.5.3 version.

I had the same error using 2.5.6 version of openpyxl and trying to save a pandas DataFrame with a DatetimeIndex. Downgrading it to 2.5.3 solved it for me.

Thom C
  • 1
  • 1