Skip to content

REF: EA quantile logic to EA._quantile #44412

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
Nov 28, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

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.

I am personally not super fond of moving this code. The ExtensionArray class also serves as a base class and example implementation for external EA authors, and for that purpose I am not sure this is useful (it allows to override it, of course (I don't know if we had feature requests for that up to now?), but for that purpose I would also simplify the base implementation).

(the dual use case as base class for internal usage vs external usage is sometimes a bit conflicting ..)

Is it really annoying to have the code in array_algos/quantile.py ?

ExtensionArray compatibility layer for quantile_with_mask.

We pretend that an ExtensionArray with shape (N,) is actually (1, N,)
for compatibility with non-EA code.
Copy link
Member

Choose a reason for hiding this comment

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

This docstring would need to be updated to be written for EA implementors (eg for those it doesn't matter this is a compatility layer for quantile_with_mask)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, will update

@jbrockmendel
Copy link
Member Author

(the dual use case as base class for internal usage vs external usage is sometimes a bit conflicting ..)

i sympathize with this

Is it really annoying to have the code in array_algos/quantile.py ?

A bit, yes. The idea of array_algos is to not depend on EA implementation details (the docstring in array_algos.__init__ hints at this). More importantly, the special-treatment of pandas-internal (i.e. MaskedArray and a bit more subtly Sparse) is a pattern we've been trying to avoid. I don't see any other way around this, am open to ideas.

@jreback jreback added the ExtensionArray Extending pandas with custom dtypes or arrays. label Nov 13, 2021
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.

am fine with this, though anyway to combine some of the added code that is in base & masked?

@jreback jreback added this to the 1.4 milestone Nov 28, 2021
@jbrockmendel
Copy link
Member Author

though anyway to combine some of the added code that is in base & masked?

there might be, but i haven't found it. trouble is we call the constructors differently in the masked code

@jreback jreback merged commit 4d6a066 into pandas-dev:master Nov 28, 2021
@jbrockmendel jbrockmendel deleted the ref-quantile-2 branch November 28, 2021 19:38
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants