-
-
Notifications
You must be signed in to change notification settings - Fork 154
feat: reduce np.ndarray #1462
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
feat: reduce np.ndarray #1462
Conversation
|
|
||
| class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate): | ||
| codes: np.ndarray = ... | ||
| codes: npt.NDArray[Any] = ... |
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.
np_1d_array[np.intp]?
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.
cmp0xff
left a comment
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.
/pandas_nightly
|
|
||
| class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate): | ||
| codes: np.ndarray = ... | ||
| codes: npt.NDArray[Any] = ... |
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.
cmp0xff
left a comment
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.
/pandas_nightly
Dr-Irv
left a comment
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.
A few main issues:
- I think we should be consistent in the stubs in using the
np_ndarray_xxxtypes that are now in_typing.pyi, rather thannpt.NDArray[np.integer], etc. I think it's better to use those types that we have in_typing.pyiso we can be consistent througout the stubs. pd.unique(someIndex)andIndex.unique()are a bit of a mess, because the behavior changes from 2.3 to 3.0. See the release notes: https://pandas.pydata.org/docs/dev/whatsnew/v3.0.0.html#other . So what we need to do here is return thenumpytypes as is done in 2.3, and put in a comment to switch to theIndextypes when 3.0 is released.- I don't think we should use
npt.NDArray[np.double]in the stubs. We always usenp.floating - There are places where we can be more precise on what are the allowed numpy array types as arguments.
I didn't necessarily pick up everything related to the main issues, and some of my comments are related to the 3 issues above.
Dr-Irv
left a comment
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.
This is getting pretty close
…f10f24c48218f3268279ec5d33cc70#r2511081138
…f10f24c48218f3268279ec5d33cc70#r2510949482
cmp0xff
left a comment
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.
/pandas_nightly
Dr-Irv
left a comment
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.
thanks @cmp0xff
npt.NDArrayto benpt.NDArray[Any]