-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEP: Enforce deprecation of squeeze argument in groupby #49082
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
Conversation
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.
key = Timestamp("2013-12-31") | ||
ordering = df["Date"].sort_values().dropna().index | ||
mi = MultiIndex.from_product([[key], ordering], names=["Date", None]) | ||
|
||
ex_values = df["Quantity"].take(ordering).values * 2 | ||
expected = Series(ex_values, index=mi, name="Quantity") | ||
tm.assert_series_equal(res, expected) | ||
expected = DataFrame( | ||
[[36, 6, 6, 10, 2]], | ||
index=Index([Timestamp("2013-12-31")], name="Date"), | ||
columns=Index([0, 1, 5, 2, 3], name="Quantity"), | ||
) | ||
tm.assert_frame_equal(res, expected) |
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.
niiice
|
||
with tm.assert_produces_warning(FutureWarning, match="`squeeze` parameter"): | ||
gb = df.groupby(tdg, squeeze=True) | ||
gb = df.groupby(tdg) |
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.
I think you can just remove this entire test as it was intentionally testing the squeeze functionality
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.
Yeah true, but this shows nicely how it changed in cases where squeeze had an actual effect. I think this would be nice in our history if someone wants to go back and 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. @WillAyd feel free to merge when satisfied
@phofl looks like a merge conflict needs fixing - otherwise good to go |
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 after conflict fixup
#32380