-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG/TST: Address GH28283 calling __finalize__ in pivot_table, groupby.median and groupby.mean #39473
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
BUG/TST: Address GH28283 calling __finalize__ in pivot_table, groupby.median and groupby.mean #39473
Conversation
pandas/core/reshape/pivot.py
Outdated
table = concat(pieces, keys=keys, axis=1) | ||
return table.__finalize__(data, method="pivot_table") | ||
|
||
table = _pivot_table( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is way more complicated to read. need to simplify this or have a better name for _pivot_table -> __internal_pivot_table, and add a doc-string & types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this maybe worth reverting and doing in a dedicated PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just finished reading the requirements for doc-string. Will rename the function and add a doc-string & types.
where is this? |
@liaoaoyuan97 if you can fix up would be great. (and merge master) |
) -> DataFrame: | ||
""" | ||
Equivalent of :func:`pandas.pivot_table`, except only allowing non-list ``aggfunc``. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback I didn't use a sharing doctring since other methods sharing it need to change. Considering it is for internal use only, devs can find reference by knowing the relation btw internal and external ones.
Please let me know your thoughts.
@jreback I think all your comments are addressed. Would you ming taking a took? |
@rhshadrach if you'd have a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just a small request on the docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @liaoaoyuan97
Thanks @liaoaoyuan97! |
Progress towards #28283
pivot_table
function to avoid overhead of_finalize__
calls when a list of aggfuncs passed__finalize__
before returninggroupby.mean
andgroupby.median
groupby.std/var/sem/size/ohlc/describe
as a reminder to fix(they are failing currently)