I am trying to write 2 Sheets in a new Excel file
with pd.ExcelWriter(outputDetailsFile) as writer:
df1.to_excel(writer, sheet_name='FA',index = False)
df2.to_excel(writer, sheet_name='TA', index = False)
The above code is working fine. There is only 1 row in that in "df1" Therefore, I need the First Sheet "FA" to be written Vertically instead of Horizontally for better readability
At present it is writing like this :
It should Write like this :
Please suggest
CodePudding user response:
Try transposing the index and columns using the T
accessor:
df1.T.to_excel(writer, sheet_name='FA',index = False)