<jupyter_start><jupyter_text>Create DataFrame<jupyter_code>df1 = pd.DataFrame({ 'A' : 1.,
              'B' : pd.Timestamp('20170101'),
              'C' : pd.Series(1,index=list(range(4)),dtype='float32'),
              'D' : np.array([3] * 4, dtype='int32'),
              'E' : pd.Categorical(["test","train","test","train"]),
              'F' : 'foo' })
df1<jupyter_output><empty_output><jupyter_text>Write to Excel<jupyter_code>writer = pd.ExcelWriter('Out_01.xlsx', engine='xlsxwriter')
df1.to_excel(writer, sheet_name='FirstSheet',startrow=1, index=False)
writer.save()<jupyter_output><empty_output><jupyter_text>Create another DataFrame which would like to apppend to original DataFrame<jupyter_code>df2 = pd.DataFrame({ 'A' : 2.,
              'B' : pd.Timestamp('20170102'),
              'C' : pd.Series(1,index=list(range(4)),dtype='float32'),
              'D' : np.array([3] * 4, dtype='int32'),
              'E' : pd.Categorical(["test","train","test","train"]),
              'F' : 'ood' })
df2<jupyter_output><empty_output><jupyter_text>Append DataFrame to existing xlsx sheet<jupyter_code>book = load_workbook('Out_01.xlsx')
writer = pd.ExcelWriter('Out_01.xlsx', engine='openpyxl') 

writer.book = book
writer.sheets = dict((ws.title, ws) for ws in book.worksheets)

df2.to_excel(writer, "FirstSheet", startrow=6, header=False, index=False)

writer.save()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1806543385490754, 'fraction_numerical': 0.034139402560455195, 'mean_word_length': 4.25, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '533390', 'license': 'MIT', 'n_tokens_mistral': 545, 'n_tokens_neox': 517, 'n_words': 76, 'path': 'Create Xlsx File/Create & Write Xlsx File.ipynb', 'repo_name': 'iamshihshan/Project', 'size': '1406'}