Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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.

2 participants