import pandas as pd
df = pd.DataFrame(zip([1010, 2020, 3030, 2020, 1515, 3030, 4545], [0.1, 0.2,
    0.33, 0.25, 0.5, 0.75, 0.45], [0.1, 0.2, 0.33, 0.25, 0.5, 0.75, 0.45]))
writer = pd.ExcelWriter('test.xlsx', engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1')
workbook = writer.book
worksheet = writer.sheets['Sheet1']
format1 = workbook.add_format({'num_format': '#,##0.00'})
format2 = workbook.add_format({'num_format': '0%'})
format3 = workbook.add_format({'num_format': 'h:mm:ss AM/PM'})
worksheet.set_column('B:B', 18, format1)
worksheet.set_column('C:C', None, format2)
worksheet.set_column('D:D', 16, format3)
writer.save()
Запись pandas DataFrame в Excel с разными форматами для разных столбцов