Skip to content
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: pandas.testing.assert_frame_equal with check_dtype=False unexpectedly raises an exception #37609

Closed
augustin-barillec opened this issue Nov 3, 2020 · 3 comments · Fixed by #38157
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Testing pandas testing functions or related to the test suite
Milestone

Comments

@augustin-barillec
Copy link

This code

import pandas
from datetime import datetime
df1 = pandas.DataFrame({'a': []}) 
df2 = pandas.DataFrame({'a': []})
df1['a'] = pandas.to_datetime(df1['a'])
pandas.testing.assert_frame_equal(df1, df2, check_dtype=False)

raises:

AssertionError: right is not an ExtensionArray

But should it raise instead no exception as df1 and df2 are identical, except for their dtypes ?

@augustin-barillec augustin-barillec added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 3, 2020
@arw2019 arw2019 added Dtype Conversions Unexpected or buggy dtype conversions Testing pandas testing functions or related to the test suite labels Nov 3, 2020
@arw2019
Copy link
Member

arw2019 commented Nov 3, 2020

I think you're right, will look

@ssortman
Copy link
Contributor

ssortman commented Nov 6, 2020

Hi. I'm new and looking to help out on this project! Is this an issue that I'd be able to pick up and work on?

ssortman added a commit to ssortman/pandas that referenced this issue Nov 28, 2020
When using assert_frame_equal on two DataFrames that are equal, besides for their dtypes, one dtype being datetime64[ns] and the other not being an extension array, the code raises an exception due to an assertion that checks whether both are extension arrays. This fix addresses issue pandas-dev#37609.
ssortman added a commit to ssortman/pandas that referenced this issue Nov 29, 2020
When using assert_frame_equal on two DataFrames that are equal, besides for their dtypes, one dtype being datetime64[ns] and the other not being an extension array, the code raises an exception due to an assertion that checks whether both are extension arrays. This fix addresses issue pandas-dev#37609.
ssortman added a commit to ssortman/pandas that referenced this issue Nov 29, 2020
When using assert_frame_equal on two DataFrames that are equal, besides for their dtypes, one dtype being datetime64[ns] and the other not being an extension array, the code raises an exception due to an assertion that checks whether both are extension arrays. This fix addresses issue pandas-dev#37609.
@jreback jreback added this to the 1.2 milestone Dec 2, 2020
@jreback jreback removed the Needs Triage Issue that has not been reviewed by a pandas team member label Dec 2, 2020
@augustin-barillec
Copy link
Author

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants