pandas dataframe to excel sheet code example
Example 1: export a dataframe to excel pandas
df.to_excel(r'Path where you want to store the exported excel file\File Name.xlsx', index = False)
Example 2: save to excel pandas
>>> df1 = pd.DataFrame([['a', 'b'], ['c', 'd']],
... index=['row 1', 'row 2'],
... columns=['col 1', 'col 2'])
>>> df1.to_excel("output.xlsx")
Example 3: python dataframe to excel
with pd.ExcelWriter('pandas_multiple.xlsx', engine='xlsxwriter') as writer:
final_df.to_excel(writer, sheet_name='Sheet1')
df_unigrams.to_excel(writer, sheet_name='Sheet2')
df_bigrams.to_excel(writer, sheet_name='Sheet3')