Skip to content

REF: use unpack_zerodim_and_defer on EA methods #34042

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 7 commits into from
Aug 7, 2020

Conversation

jbrockmendel
Copy link
Member

No description provided.

@@ -1181,10 +1181,6 @@ def convert_values(param):
ovalues = [param] * len(self)
return ovalues

if isinstance(other, (ABCSeries, ABCIndexClass)):
# rely on pandas to unbox and dispatch to us
return NotImplemented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I wouldn't use the decorator here. This class is meant to be used by external EA authors (and in that way also serves somewhat as documentation), and it is not used internally (except for tests).
I find the "easy understandability" in this case more important than the small code duplication (so it is clear to EA authors this method is returning NotImplemented for pandas objects.

And you can add ABCDataFrame to the check to make it correct (and we should have a test to catch this ..)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine to make this change. why have extra-boilerplate code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have extra-boilerplate code

For the reason I gave in the above comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simply remove it here? (or actually give arguments for why you want to change it)
This is basically a toy/helper implementation that is not used internally.

(I am completely fine with the rest of the PR)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbrockmendel I am ok with this here, but I suppose @jorisvandenbossche is stronger here, I guess revert this part.; though this makes things a bit inconsistent across pandas which is odd

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.

Apart from the one comment about the ScalarOps mixin, looks good.

We have test_direct_arith_with_series_returns_not_implemented tests in the base extensions. Could you add DataFrame in that test as well?

@jreback jreback added Clean ExtensionArray Extending pandas with custom dtypes or arrays. labels May 7, 2020
@jreback jreback added this to the 1.1 milestone May 7, 2020
@jreback
Copy link
Contributor

jreback commented May 25, 2020

@jbrockmendel I am +1 on this, can you merge master. If @jorisvandenbossche object to the array/base.py impl then ok but otherwise lgtm.

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.

We have test_direct_arith_with_series_returns_not_implemented tests in the base extensions. Can you add DataFrame in that test as well?

@@ -1181,10 +1181,6 @@ def convert_values(param):
ovalues = [param] * len(self)
return ovalues

if isinstance(other, (ABCSeries, ABCIndexClass)):
# rely on pandas to unbox and dispatch to us
return NotImplemented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simply remove it here? (or actually give arguments for why you want to change it)
This is basically a toy/helper implementation that is not used internally.

(I am completely fine with the rest of the PR)

@jreback
Copy link
Contributor

jreback commented Jun 1, 2020

can u rebase and add the suggested test

@jbrockmendel
Copy link
Member Author

Mothballing

@jbrockmendel jbrockmendel added the Mothballed Temporarily-closed PR the author plans to return to label Jun 11, 2020
@jorisvandenbossche
Copy link
Member

I reopened this because I think it are useful changes. I only changed it back in the base implementation (which is not used in pandas), as I suggested above.
@jbrockmendel are you fine with merging it like this?

@jorisvandenbossche jorisvandenbossche removed the Mothballed Temporarily-closed PR the author plans to return to label Jun 12, 2020
@jreback jreback removed this from the 1.1 milestone Jul 9, 2020
@jbrockmendel
Copy link
Member Author

@jorisvandenbossche i just rebased and force-pushed, might have undone the commit you pushed. feel free to re-do that

@jorisvandenbossche
Copy link
Member

I forced pushed again my branch, but it still needs a merge of master.

@jorisvandenbossche
Copy link
Member

And also merged master

@jreback jreback added this to the 1.2 milestone Aug 6, 2020
@jreback
Copy link
Contributor

jreback commented Aug 6, 2020

lgtm. @jorisvandenbossche merge when ready. (or ping and i will)

@jorisvandenbossche jorisvandenbossche merged commit 319a6d3 into pandas-dev:master Aug 7, 2020
@jbrockmendel jbrockmendel deleted the boilerplate-4 branch November 20, 2021 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants