I have created a python script that import data from csv using pandas, then merges the data so it is side by side, and then saves it as an excel sheet with all the data. I would like to add a row above the headers so I can write which excel sheet each column of data came from. Is this possible in python?
For example, an excel sheet may have columns, Time and mutiple mass columns from different spreadsheets. I would like to add a row above so I can say which spreadsheet the mass column came from. I have shown the current spreadsheet output and the one I want in the images attached.
I have included the code that I think is relevant beow
wb_opened = pandas.read_excel(filename_link,header = None) ## Imports the data
wb_opened = wb_opened.set_index(column_number) ## Set the datafram index
wb_opened.columns = wb_opened.iloc[variable_row_local]
wb_opened = wb_opened.iloc[(variable_row_local) :] ## removes the blank data before the main data
main_data = pandas.merge(main_data,data,left_index=True,right_index=True)
##main_data is the output spreadsheet