-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CI: PY311 failures #50124
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
Comments
Looks like it's a new numpy version: Package Version_x Version_y
0 ---------------- ------------------------- --------------------------
7 numpy 1.25.0.dev0+79.g01d64079b 1.25.0.dev0+165.g6f9237e91
8 packaging 21.3 22.0 |
The test introduced in #43870 is now failing cc @jbrockmendel @alexhlim (no blame) I don't really understand why the deprecation warning was filtered out in that test - wasn't it warning us that this was going to fail? $ cat t.py
import numpy as np
nat_1 = np.datetime64('NaT', 'Y')
nat_2 = np.datetime64('NaT', 'ps')
{nat_1}.add(nat_2)
$ python t.py
t.py:5: DeprecationWarning: elementwise comparison failed; this will raise an error in the future.
{nat_1}.add(nat_2)
EDIT: not sure the deprecation warning should've been raised in the first place - isn't it usually raised when arrays aren't of the same length, e.g. In [1]: np.arange(10)==np.arange(5,14)
<ipython-input-1-689dbe3c0296>:1: DeprecationWarning: elementwise comparison failed; this will raise an error in the future.
np.arange(10)==np.arange(5,14)
Out[1]: False ? |
The following is also causing issues now: pandas/pandas/core/arrays/masked.py Lines 722 to 731 in 0ca49fc
Test that hits this
|
numpy/numpy#13548 fixed a couple days ago probably related |
With numpy 1.23.5: In [1]: np.array([1, 3]) == np.array([4, pd.NA])
<ipython-input-1-b84677c04e2f>:1: DeprecationWarning: elementwise comparison failed; this will raise an error in the future.
np.array([1, 3]) == np.array([4, pd.NA])
Out[1]: False With the latest nightly: In [1]: np.array([1, 3]) == np.array([4, pd.NA])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 1
----> 1 np.array([1, 3]) == np.array([4, pd.NA])
File ~/pandas-dev/pandas/_libs/missing.pyx:413, in pandas._libs.missing.NAType.__bool__()
411
412 def __bool__(self):
--> 413 raise TypeError("boolean value of NA is ambiguous")
414
415 def __hash__(self):
TypeError: boolean value of NA is ambiguous |
The change is that NumPy is now (not in the upcoming 1.24 release!) raising errors that occur during comparisons. I would not love to undo that step, these deprecation/futurewarnings were a long pain-point. The way specific cases are handled can definitely be tweaked of course! |
Thanks @seberg for stepping in! Not really sure what to do here - @jbrockmendel @mroeschke thoughts on how to "save" |
Maybe it's OK to just let numpy error for this comparison? It only appears in a single test - and even then, the original issue which motivated it had a comparison between |
im not firing on all cylinders today, will take a closer look in the AM |
From a quick glance, I would think that a proper fix would involve |
What should idx = Index([1, 2, np.datetime64('NaT', 'Y')])
target = Index([np.datetime64('NaT', 'ps')], dtype=object)
idx.get_indexer_non_unique(target) return if As far as I can tell, we're doomed from the start trying to support this I'd just let numpy error to be honest, if someone has uncomparable types in an array they're going to run into other issues anyway |
SummaryAs the conversation's a bit scattered between here and the PR, I'll try to summarise There's 3 issues:
What to do about this? Here are my thoughts
|
@jorisvandenbossche @jreback sorry for the tags, just hoping to give this a bit more visibility |
Yes, numpy raising an error is the expected behaviour I would say (or at least a direct consequence of our choice to have comparisons with NA return NA, and to have the bool value of NA being ambiguous) It's of course another case of object dtype arrays with NA not really being useful / working correctly (xref #32931) |
w/r/t different-unit
|
Both on builds from
main
and1.5.x
:https://github.com/pandas-dev/pandas/actions/runs/3647663722/jobs/6160167738
The text was updated successfully, but these errors were encountered: