ENH Assert_frame_equal check_names to True #2964
Merged
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.
This is a follow up to #2962, where I added a
check_names=False
argument toassert_frame_equal
, this defaults it toTrue
. That is, when asserting two DataFrames are equal, it compares.columns.names
and.index.names
, unless explicitly passingcheck_names=False
.I've added in
check_names=False
where it wouldn't make sense to check names. I've added a TODO comment (andcheck_names=False
) where I think it probably should work but isn't... This was in the following cases:i.e. these appear to drop column names (
df.columns.names
). Whether this behaviour is correct / desired in these cases, I'm not sure, but here they all are. :)Note: By changing the A1 cells to 'index', I had all but one test (labelled "read xls ignores index name ?") in
test_excel.py
working locally (withcheck_names=True
) , however Travis was less convinced throwing:so I reverted to the previous xls and xlsx, and added back in
check_names=False
. I suspect LibreOffice wasn't saving it properly...?