-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: add some types to pandas/core/arrays/numpy_.py #29969
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
TYP: add some types to pandas/core/arrays/numpy_.py #29969
Conversation
pandas/core/arrays/numpy_.py
Outdated
@@ -137,8 +138,8 @@ def __init__(self, values, copy=False): | |||
if copy: | |||
values = values.copy() | |||
|
|||
self._ndarray = values | |||
self._dtype = PandasDtype(values.dtype) | |||
self._ndarray: np.ndarray = values |
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.
Should we move the definition to the class level as in some of the work @jbrockmendel has been doing as well? Off the top of my head I thought that was the PEP recommendation
pandas/core/arrays/numpy_.py
Outdated
self._ndarray = values | ||
self._dtype = PandasDtype(values.dtype) | ||
self._ndarray: np.ndarray = values | ||
self._dtype: ExtensionDtype = PandasDtype(values.dtype) |
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.
is PandasDtype valid here? seems more specific
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'll remove for now. mypy may no longer require this type annotation.
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.
Lgtm when green
rebased + green |
Thanks @simonjayhawkins |
broken off #28339