Skip to content

TST: Add test inconsistency in group by (#44803) #45509

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 3 commits into from
Jan 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pandas/tests/groupby/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
from pandas.core.groupby.base import maybe_normalize_deprecated_kernels


def test_group_by_copy():
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm actually should be in pandas/tests/groupby/test_apply_mutate.py

@NumberPiOso if you wouldn't mind doing a PR to move this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! , PR#45578

# GH#44803
df = DataFrame(
{
"name": ["Alice", "Bob", "Carl"],
"age": [20, 21, 20],
}
).set_index("name")

grp_by_same_value = df.groupby(["age"]).apply(lambda group: group)
grp_by_copy = df.groupby(["age"]).apply(lambda group: group.copy())
tm.assert_frame_equal(grp_by_same_value, grp_by_copy)


def test_repr():
# GH18203
result = repr(Grouper(key="A", level="B"))
Expand Down