Open idantene opened 4 years ago
Do we have any other engine-specific formatters that affects how we write cells? Or is ExcelFormatter supposed to be agnostic to the engine?
I believe ExcelFormatter is intended to be agnostic to the engine.
Bringing this back up again.
+1 on this being very useful, even 10k rows requires a workaround (several 100s of mB of memory used otherwise)
+1 It's very useful
+1 It's very useful
Is your feature request related to a problem?
When writing large DataFrames to an Excel file using
XlsxWriter
, one can use theoptions={'constant_memory': True}
keyword arguments. However, per the documentation: once this mode is active, data should be written in sequential row order.The way pandas works at the moment, is that cells are written per series first, so column-by-column. This effectively writes the DataFrame so that only the first column and last row are fully written (along with the column names, which are written as a single row).
Describe the solution you'd like
It would be great to add an axis-like argument in the
to_excel
method, controlling how the data is written to the file (by columns (series) or by rows).API breaking implications
There should be no breaking implications. This new argument can have a default value that matches the current implementation.
Describe alternatives you've considered
Monkeypatching the ExcelFormatter as such works fine:
Additional context
Reproducible minimal example: