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 5 commits into from
Jun 17, 2021


Copy link

@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.


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

# 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
00 - Bug 08 - Backport Used to tag backport PRs
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants