-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
MNT: Bump dev pin on NumPy #60987
MNT: Bump dev pin on NumPy #60987
Changes from all commits
658c4d5
e424a96
912bc1b
e75abfe
856a52f
a8304b6
41265f3
9c2f5ac
f6a2330
83e2644
8fd50b4
f7ef882
347b865
17ec834
65e1374
14d34a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -804,9 +804,9 @@ def argmax( | |
dtype: float64 | ||
|
||
>>> s.argmax() | ||
2 | ||
np.int64(2) | ||
>>> s.argmin() | ||
0 | ||
Comment on lines
806
to
-809
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few of these where I'm wondering if we should be returning Python scalars instead of NumPy. Should issues be opened for these? cc @pandas-dev/pandas-core There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think generally we always want to return Python scalars (IIRC we got a lot of issues about this in iteration and iteration-like APIs in the past) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even just wrapping the result of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree we should always return Python scalars. I'm surprised at the amount of failures that expect NumPy scalars There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd think you need a deprecation on this, because people may have code that depends on the result being a numpy scalar. I think that the tests we have in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could put it up behind a |
||
np.int64(0) | ||
|
||
The maximum cereal calories is the third element and | ||
the minimum cereal calories is the first element, | ||
|
@@ -1360,7 +1360,7 @@ def factorize( | |
dtype: int64 | ||
|
||
>>> ser.searchsorted(4) | ||
3 | ||
np.int64(3) | ||
|
||
>>> ser.searchsorted([0, 4]) | ||
array([0, 3]) | ||
|
@@ -1379,7 +1379,7 @@ def factorize( | |
dtype: datetime64[s] | ||
|
||
>>> ser.searchsorted('3/14/2000') | ||
3 | ||
np.int64(3) | ||
|
||
>>> ser = pd.Categorical( | ||
... ['apple', 'bread', 'bread', 'cheese', 'milk'], ordered=True | ||
|
@@ -1389,7 +1389,7 @@ def factorize( | |
Categories (4, object): ['apple' < 'bread' < 'cheese' < 'milk'] | ||
|
||
>>> ser.searchsorted('bread') | ||
1 | ||
np.int64(1) | ||
|
||
>>> ser.searchsorted(['bread'], side='right') | ||
array([3]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In https://github.com/pandas-dev/pandas/pull/60987/files#r2016346826 I commented because the dtype of the array was the same as the dtype of the scalars.
Thinking some more, we currently have...
so for consistency, even object arrays should probably not show the NEP51 repr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's an option here, this is what happens when you call
str
on a tuple of NumPy scalars.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://peps.python.org/pep-3140/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems reasonable however extending the example I gave for the strings in an object array...
however, we don't currently display the repr for strings in a collection either when the array is displayed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, the numpy array of values does show the repr for the strings in a tuple.