I have a DataFrame
df = pd.DataFrame({'Data': [10, 20, 30, 20, 15, 30, 45]})
This is working:
writer = pd.ExcelWriter('pandas_simple.xlsx', engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1')
writer.save()
but when I try:
out_path = "C:\Users\Bala\output\temp-excel.xlsx"
writer = pd.ExcelWriter(out_path , engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1')
writer.save()
I'm getting error:
IOError: [Errno 22] invalid mode ('wb') or filename: 'C:\\Users\\Bala Nadella\\output\temp-excel.xlsx'.
How can I create a file at a given path?