-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix .to_excel() for MultiIndex containing a NaN value #13511 #13551
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
Merged
jorisvandenbossche
merged 4 commits into
pandas-dev:master
from
mpuels:fix-multiindex-nan-label-to-excel
Jul 25, 2016
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9abc4e8
BUG: Fix .to_excel() for MultiIndex containing a NaN value #13511
mpuels ba41db6
CLN: Get rid of conditional.
mpuels 335cf86
BUG: Fix .to_excel() for MultiIndex containing a NaN value #13511
mpuels 2335cee
TST: Construct DataFrame specifically for test, instead of reusing ex…
mpuels File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this doesn't need the
allow_fill
argument.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.
@jreback that value is by default True, and once you pass a
fill_value
, you get an error for integer levels. So it is either passingallow_fill
like above, or eiter passingfill_value
conditionally like it was initially in this PRThere 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.
it doesn't change the test result with my change
this their is not enough testing here to catch things
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.
If I leave out the
allow_fill=levels._can_hold_na
, I get:But the problem is that the test frame only contains floats. @mpuels can you update the test to also include an integer index case?
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.
@jorisvandenbossche I'm sorry, but I can't follow you. I guess when you say
then you mean the MultiIndex of the DataFrame in my test case only contains floats and that I shall construct a test case where each level of the MultiIndex is of type integer?
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.
yes indeed, that is what I meant!
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.
(because the reason you have to specify
allow_fill
is otherwise not tested)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.
@jorisvandenbossche So you claim that if I substitute
with
that no test will detect the change, i.e. that all tests pass? I ran the tests by entering
against the PR which contains
allow_fill=levels._can_hold_na
and then applied the aforementioned substitution and ran the tests again. In the first case the output isand in the second case it is
So the test which I constructed for this PR did not fail, but three other tests which already exist. Shall I nonetheless construct another test case where the Index contains integers? Or did I miss anything? Thanks for your patience!
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.
I didn't claim that very strongly :-)
I only ran the specific test here in this PR, and there it is not catched, but as you show it is certainly catched in the other tests, so OK then!