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: Invalid dtypes comparison should not raise TypeError #19269

Merged
merged 5 commits into from
Jun 17, 2021

Conversation

charris
Copy link
Member

@charris charris commented Jun 17, 2021

Backport of #19228.

Invalid dtypes comparison

Changes behavior of comparison to not raise TypeError when one of the operands cannot be converted to valid dtype.

Example:

>>> dtype = pd.date_range("2016-01-01", periods=2, tz="UTC").dtype
>>> dtype == np.dtype("datetime64[ns]")
False
>>> np.dtype("datetime64[ns]") == dtype
False

# Before:
>>> np.dtype("datetime64[ns]") == dtype
TypeError: Cannot interpret 'datetime64[ns, UTC]' as a data type

resolves #19187

@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Jun 17, 2021
@charris charris added this to the 1.21.0 release milestone Jun 17, 2021
@charris charris merged commit 143d45f into numpy:maintenance/1.21.x Jun 17, 2021
@charris charris deleted the backport-19228 branch June 17, 2021 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 08 - Backport Used to tag backport PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants