Skip to content

Commit 94fbed6

Browse files
authored
TST: Add test inconsistency in group by (#44803) (#45509)
1 parent 45257d1 commit 94fbed6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pandas/tests/groupby/test_groupby.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@
3232
from pandas.core.groupby.base import maybe_normalize_deprecated_kernels
3333

3434

35+
def test_group_by_copy():
36+
# GH#44803
37+
df = DataFrame(
38+
{
39+
"name": ["Alice", "Bob", "Carl"],
40+
"age": [20, 21, 20],
41+
}
42+
).set_index("name")
43+
44+
grp_by_same_value = df.groupby(["age"]).apply(lambda group: group)
45+
grp_by_copy = df.groupby(["age"]).apply(lambda group: group.copy())
46+
tm.assert_frame_equal(grp_by_same_value, grp_by_copy)
47+
48+
3549
def test_repr():
3650
# GH18203
3751
result = repr(Grouper(key="A", level="B"))

0 commit comments

Comments
 (0)