Skrip Python untuk menulis DataFrame di Excel
df.to_excel('pandas_to_excel.xlsx', sheet_name='new_sheet_name')
Sounkalo traoré
df.to_excel('pandas_to_excel.xlsx', sheet_name='new_sheet_name')
import pandas as pd
import openpyxl
df = pd.DataFrame([[11, 21, 31], [12, 22, 32], [31, 32, 33]],
index=['one', 'two', 'three'], columns=['a', 'b', 'c'])
print(df)
# a b c
# one 11 21 31
# two 12 22 32
# three 31 32 33
$ pip install xlwt
$ pip install openpyxl