Skip to content

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

Merged
merged 23 commits into from
Feb 10, 2020

Conversation

jbrockmendel
Copy link
Member

No description provided.

@pep8speaks
Copy link

pep8speaks commented Feb 3, 2020

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


@property
def dtype(self):
return self._data.dtype
Copy link
Member

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?

@@ -221,6 +224,20 @@ def __getitem__(self, key):
def __iter__(self):
return self._data.__iter__()

def __len__(self) -> int:
return len(self._data)
Copy link
Member

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

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a 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?

@property
def size(self) -> int:
# If EA ever requires size, this can become self._data.size
return len(self)
Copy link
Member

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__",
Copy link
Contributor

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?

Copy link
Contributor

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.

@jreback jreback added ExtensionArray Extending pandas with custom dtypes or arrays. Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Feb 5, 2020
@jreback jreback added this to the 1.1 milestone Feb 5, 2020
Copy link
Contributor

@jreback jreback left a 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):
Copy link
Contributor

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)?

@jreback
Copy link
Contributor

jreback commented Feb 9, 2020

cc @jorisvandenbossche

@jreback jreback merged commit f27d70f into pandas-dev:master Feb 10, 2020
@jreback
Copy link
Contributor

jreback commented Feb 10, 2020

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the ref-ei-delegate4 branch February 10, 2020 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays. Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants