Issue
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
Solution
Try transposing the index and columns using the T
accessor:
df1.T.to_excel(writer, sheet_name='FA',index = False)
Answered By - Anders Källmar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.