Unable to use pandas excel writer with zipline dataframe?

236 Views Asked by At

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'

1

There are 1 best solutions below

0
On

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.