Skip to content

TST: Change test_groupby_copy to apply_mutate.py #45578

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 2 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
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_apply_mutate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
import pandas._testing as tm


def test_group_by_copy():
# GH#44803
df = pd.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_mutate_groups():

# GH3380
Expand Down
14 changes: 0 additions & 14 deletions pandas/tests/groupby/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@
from pandas.core.groupby.base import maybe_normalize_deprecated_kernels


def test_group_by_copy():
# 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