-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix error for boxplot
when using a pre-grouped DataFrame
with more than one grouping
#57985
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
Changes from 7 commits
81607c3
6a346dd
3c741ea
e9811fc
6f084e1
a326529
50c0e38
dacaf2d
e3124c0
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 |
---|---|---|
|
@@ -533,14 +533,16 @@ def boxplot_frame_groupby( | |
) | ||
axes = flatten_axes(axes) | ||
|
||
ret = pd.Series(dtype=object) | ||
|
||
data = {} | ||
for (key, group), ax in zip(grouped, axes): | ||
d = group.boxplot( | ||
ax=ax, column=column, fontsize=fontsize, rot=rot, grid=grid, **kwds | ||
) | ||
ax.set_title(pprint_thing(key)) | ||
ret.loc[key] = d | ||
# GH 14701 refactored to allow the 'key' to be passed as a tuple, | ||
# which occurs when there is more than one group | ||
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. I think this comment should be removed. |
||
data[key] = d | ||
ret = pd.Series(data) | ||
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. We don't need to be creating 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. No problem. |
||
maybe_adjust_figure(fig, bottom=0.15, top=0.9, left=0.1, right=0.9, wspace=0.2) | ||
else: | ||
keys, frames = zip(*grouped) | ||
|
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 no longer accurate. I'd recommend something more generic, such as
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.
Correct. I will update it.