Create, write to and save a workbook:

In [ ]:
import numpy as np
import pandas as pd

To specify the sheet name:

In [ ]:
df1 = pd.DataFrame([['p', 'q'], ['r', 's']],
                   index=['row 1', 'row 2'],
                   columns=['c1', 'c2'])
In [ ]:
             sheet_name='Sheet_name_1')  # doctest: +SKIP

To write more than one sheet in the workbook, it is necessary
to specify an ExcelWriter object:

In [ ]:
df2 = df1.copy()
with pd.ExcelWriter('output.xlsx') as writer:  # doctest: +SKIP
    df1.to_excel(writer, sheet_name='Sheet_name_1')
    df2.to_excel(writer, sheet_name='Sheet_name_2')

To set the library that is used to write the Excel file, you can pass the engine keyword:

In [ ]:
df1.to_excel('output1.xlsx', engine='xlsxwriter')  # doctest: +SKIP