'How to export large pandas Data Frame to excel format?
I have converted binary files to NumPy array and then pandas data frame. The final shape is 217 rows × 524289 columns.
When I tried to save it as .xlsx format:
dft.to_excel('dft.xlsx')
the below error appeared:
ValueError: This sheet is too large! Your sheet size is: 217, 524289 Max sheet size is: 1048576, 16384
I would really appreciate your responses.
Solution 1:[1]
Either save as .csv, or split it into 4 dataframes before saving it as .xlsx. From the error you see that the max amount of columns is 16384, so splitting into 4 smaller dataframes would work.
Solution 2:[2]
Thanks for your comment and reply. I found a trivial solution and want to share it with you. As I tried to save it only as .xlsx (not csv), I realized it could be saved by changing the rows with columns (transpose).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | fejz1234 |
Solution 2 | AmirAbbas |