-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
ENH: Implementing NEP 18's __array_function__ #26380
Comments
This would be interesting to explore (in addition to Series.array_ufunc: #23293). |
One thing we might think about: do we want to keep this working exactly the same as the current methods, or would we want to take the opportunity to make it more compatible with numpy? Not sure that are more things, but what I am thinking about is the axis handling in case of reductions for a DataFrame (so a rather specific case, maybe not relevant for many of the functions covered by
On numpy, the default is |
@jorisvandenbossche note that for any / all, we do interpret
IIRC, that was necessary for compatibility with a change in NumPy. I may be wrong, but I think we wanted to expand that interpretation of None to all the reduction methods. edit: with a change in the default to |
Yes, I think it would be good to add that option to all reduction methods. But apart from that, it is still the question what the default |
Ah, yeah didn't mean to distract from your general point. I'm a bit
conflicted on what to do here, but following NumPy's default is probably
best. Not sure though.
…On Wed, Jun 19, 2019 at 12:52 PM Joris Van den Bossche < ***@***.***> wrote:
Yes, I think it would be good to add that option to all reduction methods.
But apart from that, it is still the question what the default np.sum(df)
should ideally do (follow numpy's default axis=None, or pandas' default
axis=0. Since numpy is calling, I personally would find it logical to
follow numpy's default).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#26380?email_source=notifications&email_token=AAKAOITYSOCTFCKJVTYRB3TP3JW5TA5CNFSM4HMUPBRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYCU2WI#issuecomment-503663961>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKAOIRQWD5D3X6PHTBGSLLP3JW5TANCNFSM4HMUPBRA>
.
|
I think we'll want to implement this for our arrays first (e.g. IntegerArray). |
I've got a branch that implements |
Dask handles that with a warning and a fallback: If we want something similar, we could cast to an ndarray as a fallback. |
My two cents:
|
The part I'm having trouble with is reliably identifying where |
cc @pentschev @rgommers (for vis) |
It would be useful to have
__array_function__
support as described in NEP 18 implemented for Pandas objects. This would allow users to run NumPy functions on Pandas objects while deferring to Pandas on how those operations should run.The text was updated successfully, but these errors were encountered: