-
-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Convert output type in Excel for MultiIndex with period levels #60182
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Please add tests whenever changing functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good - can you also add one test in excel/test_writers.py
for round-tripping (writes a DataFrame to an excel file, reads it, and asserts its the same as the original DataFrame).
My test case gets called 8 times, 6 times the dtype of result is 'datetime64[us]', and the other two times is 'datetime64[s]'. I don't know why this is happening. I had to do unit conversions for result. |
I've found that the dtype of |
And maybe it can be a new issue to unify the units of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a note in the whatsnew for v3.0.0 under the I/O section.
Sure. |
@rhshadrach I'm sorry for the trouble, but could you please let me know if there is anything else to change? Thank you very much! |
formatted_cells = formatter._format_hierarchical_rows() | ||
|
||
for cell in formatted_cells: | ||
assert not isinstance( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we assert that this is a Timestamp
instead?
@@ -691,6 +691,7 @@ I/O | |||
- Bug in :meth:`DataFrame.to_stata` when writing :class:`DataFrame` and ``byteorder=`big```. (:issue:`58969`) | |||
- Bug in :meth:`DataFrame.to_stata` when writing more than 32,000 value labels. (:issue:`60107`) | |||
- Bug in :meth:`DataFrame.to_string` that raised ``StopIteration`` with nested DataFrames. (:issue:`16098`) | |||
- Bug in :meth:`ExcelFormatter._format_hierarchical_rows` where output type in excel for multiIndex with period levels is not a date (:issue:`60099`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Bug in :meth:`ExcelFormatter._format_hierarchical_rows` where output type in excel for multiIndex with period levels is not a date (:issue:`60099`) | |
- Bug in :meth:`DataFrame.to_excel` where the a :class:`MultiIndex` index with a period level was not a date (:issue:`60099`) |
doc/source/whatsnew/v3.0.0.rst
file if fixing a bug or adding a new feature.