I have to export this dataframe to Excel
import pandas as pd
import xlsxwriter
df1 = pd.DataFrame([['a', 'b'], ['c', 'd']],
index=['row 1', 'row 2'],
columns=['col 1', 'col 2'])
df1.to_excel(os.path.join('tmp', "output1.xlsx")) # doctest: +SKIP
df2 = df1.copy()
with pd.ExcelWriter(os.path.join('tmp', "output2.xlsx"), engine='xlsxwriter') as writer: # doctest: +SKIP
df1.to_excel(writer, sheet_name='Sheet_name_1')
df2.to_excel(writer, sheet_name='Sheet_name_2')
I know that 'xlsxwriter' allows multiple customizations. How to set column width and text wrapping, taking the above code as the draft?