-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
REF: collect methods in NumericIndex #41472
Conversation
100383d
to
427e208
Compare
427e208
to
7c7db4a
Compare
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.
looks good a couple of comments
pandas/core/indexes/numeric.py
Outdated
else: | ||
return False | ||
|
||
@property |
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.
cached_property?
pandas/core/indexes/numeric.py
Outdated
np.float64: libindex.Float64Engine, | ||
}[self.dtype.type] | ||
|
||
@property |
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.
cached_property
pandas/core/indexes/numeric.py
Outdated
@@ -255,6 +357,14 @@ def asi8(self) -> np.ndarray: | |||
return self._values.view(self._default_dtype) | |||
|
|||
|
|||
_int64_descr_args = { |
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.
can you put these in the class?
Updated. |
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. @jbrockmendel if any comments
pandas/core/indexes/numeric.py
Outdated
@@ -150,13 +296,16 @@ def _is_comparable_dtype(self, dtype: DtypeObj) -> bool: | |||
return is_numeric_dtype(dtype) | |||
|
|||
@classmethod | |||
def _assert_safe_casting(cls, data, subarr): | |||
def _assert_safe_casting(cls, data, subarr) -> None: |
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.
subarr is ndarray?
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.
Yes, and data too, I can add those.
LGTM; if you find anywhere where |
Updated type hints. |
thanks @topper-123 |
Seperates the refactoring of existing methods out of #41153. Will make it easier to see what #41153 actually brings in of new things.
This PR changes no functionality, but only makes the exisiting numeric indexes into thin subclasses of the existing
NumericIndex
.