I am appending a DF to an excel sheet. For some reason my DF values are being appended to the last row of the first column in my excel, but I need it to be appended as the last column of my excel (which is column BK). I need to include the header as well but don't need the index.
The code I am using to append one specific column in my DF to my excel file
df = pd.DataFrame({"Specific_Column": ['', 'cell 5', 'cell 6']})
df.to_csv('excelfile.csv',columns=['Specific_Column'], mode='a',index=False)
What I am trying to achieve:
| columnA in excel | columnB in excel | Specific_Column | 
|---|---|---|
| Cell 1 | Cell 2 | Cell 5 | 
| Cell 3 | Cell 4 | Cell 6 | 
What is happening:
| columnA in excel | columnB in excel | 
|---|---|
| Cell 1 | Cell 2 | 
| Cell 3 | Cell 4 | 
| Specific_Column | |
| --------------- | |
| Cell 5 | |
| Cell 6 | 
 
    