I have the following code:
import pandas as pd
df2 = pd.DataFrame(dataset)
df = pd.read_excel (r'C:/adhoc/test.xlsx')
df.append(df2,ignore_index=True)
# Create a Pandas Excel writer using XlsxWriter as the engine.
writer = pd.ExcelWriter(r'C:/adhoc/test.xlsx', engine='xlsxwriter')
# Convert the dataframe to an XlsxWriter Excel object.
df.to_excel(writer, sheet_name='Sheet1')
# Close the Pandas Excel writer and output the Excel file.
writer.save()
I am trying to take df2 (the current dataset) and append it into the already exiting data (df) and write that all back into the file. Essentially take the new data and append it to the bottom of the sheet. When I run this code all it does it add an extra index column beside the already exiting index column