Skip to content

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

Merged
merged 4 commits into from
Oct 20, 2022

Conversation

phofl
Copy link
Member

@phofl phofl commented Oct 14, 2022

@phofl phofl added Groupby Deprecate Functionality to remove in pandas labels Oct 14, 2022
@phofl phofl added this to the 2.0 milestone Oct 14, 2022
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so satisfying

looks good to me

Comment on lines -902 to +905
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)
Copy link
Member

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)
Copy link
Member

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

Copy link
Member Author

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

Copy link
Member

@mroeschke mroeschke left a 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

@WillAyd
Copy link
Member

WillAyd commented Oct 20, 2022

@phofl looks like a merge conflict needs fixing - otherwise good to go

Copy link
Member

@WillAyd WillAyd left a 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

@phofl phofl merged commit fe93a83 into pandas-dev:main Oct 20, 2022
@phofl phofl deleted the dep_squeeze_groupby branch October 20, 2022 11:04
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Groupby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants