-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Reductions for ExtensionArray #22346
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
Comments
To kick things off, one option is to make EA authors implement a |
(We also have #22224) So basically, for Lines 3244 to 3266 in cf70d11
So with this existing infrastructure, it is indeed an option to let EA's implement Internally, such a pandas/pandas/core/arrays/categorical.py Lines 2077 to 2084 in cf70d11
@TomAugspurger What do you mean exactly with restrictive? (note that using We could also go the current numpy way of checking if the object has a similarly named method (so which is basically what the internal
I am not sure that we can provide helpers? I think the actual implementation (or which of the reductions work) will be rather EA dependent.
I think, if the IntegerArray implements the asked reduction, is should definitely be Int64 and not int64 (so preserving the dtype). Is there a reason not to do that? |
Ah, in case of groupby, you need to gather together the scalar results, so in that case it is indeed not that straightforward, as you then need to know the desired dtype .. (which might depend on the actual reduction type) |
Ah, by restrictive I meant it requires them to implement
I vaguely had in mind something like
Right. I think for most reductions, the result will be an instance of |
Creeping up to this in #22345
A few questions
Is it
int64
, or should we preserveInt64
?We can also discuss transforms ( cumulative operations like cumsum, maybe things like
.shift
).The text was updated successfully, but these errors were encountered: