-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Changes from 8 commits
d9e2f64
aaa09b5
820089c
02a777c
33fca3e
5f23bef
8322385
d022983
e17c31f
5ba2824
e8b9e0b
73a84b7
f058996
6a47ef3
2ac796a
b3a8a49
d9d282a
af43447
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ def pivot_table( | |
pieces: List[DataFrame] = [] | ||
keys = [] | ||
for func in aggfunc: | ||
table = pivot_table( | ||
_table = _pivot_table( | ||
data, | ||
values=values, | ||
index=index, | ||
|
@@ -70,10 +70,39 @@ def pivot_table( | |
margins_name=margins_name, | ||
observed=observed, | ||
) | ||
pieces.append(table) | ||
pieces.append(_table) | ||
keys.append(getattr(func, "__name__", func)) | ||
|
||
return concat(pieces, keys=keys, axis=1) | ||
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 commentThe 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 commentThe 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 commentThe 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. |
||
data, | ||
values, | ||
index, | ||
columns, | ||
aggfunc, | ||
fill_value, | ||
margins, | ||
dropna, | ||
margins_name, | ||
observed, | ||
) | ||
return table.__finalize__(data, method="pivot_table") | ||
|
||
|
||
def _pivot_table( | ||
data, | ||
values, | ||
index, | ||
columns, | ||
aggfunc: str, | ||
fill_value, | ||
margins, | ||
dropna, | ||
margins_name, | ||
observed, | ||
) -> DataFrame: | ||
|
||
keys = index + columns | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.