-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
REF: implement ExtensionIndex._concat_same_dtype, use for IntervalIndex #31635
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
Conversation
Hello @jbrockmendel! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-02-08 02:13:36 UTC |
pandas/core/indexes/extension.py
Outdated
|
||
@property | ||
def dtype(self): | ||
return self._data.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.
This is already included in the base Index class (with docstring actually), so I think this is not needed here?
pandas/core/indexes/extension.py
Outdated
@@ -221,6 +224,20 @@ def __getitem__(self, key): | |||
def __iter__(self): | |||
return self._data.__iter__() | |||
|
|||
def __len__(self) -> int: | |||
return len(self._data) |
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.
Same comment as below for this one
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 maybe add a comment somewhere that those attributes (__len__
, dtype
) are already dispatched to _data
in the base class?
pandas/core/indexes/extension.py
Outdated
@property | ||
def size(self) -> int: | ||
# If EA ever requires size, this can become self._data.size | ||
return len(self) |
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.
Actually, also size is already provided by the base class it seems?
@@ -183,23 +183,10 @@ def func(intvidx_self, other, sort=False): | |||
) | |||
@inherit_names(["set_closed", "to_tuples"], IntervalArray, wrap=True) | |||
@inherit_names( | |||
[ | |||
"__len__", |
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.
why don't we need the deleted ones?
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.
ahh i c, by reading comments.
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.
@@ -235,6 +243,10 @@ def repeat(self, repeats, axis=None): | |||
result = self._data.repeat(repeats, axis=axis) | |||
return self._shallow_copy(result) | |||
|
|||
def _concat_same_dtype(self, to_concat, name): |
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.
if you can type at some point (doc-string inherited)?
thanks @jbrockmendel |
No description provided.