Skip to content

Commit 95ac998

Browse files
committed
Add test case for GH14927
1 parent da5693b commit 95ac998

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/tests/groupby/test_apply.py

+17
Original file line numberDiff line numberDiff line change
@@ -940,3 +940,20 @@ def fast(group):
940940
slow_df = df.groupby("A").apply(slow)
941941

942942
tm.assert_frame_equal(fast_df, slow_df)
943+
944+
945+
def test_gh14927():
946+
# GH 14927
947+
df = pd.DataFrame({"g": [1, 2, 2, 2], "a": [1, 2, 3, 4], "b": [5, 6, 7, 8]})
948+
949+
df1 = df.groupby("g").apply(lambda x: x)
950+
951+
df2 = df.groupby("g").apply(lambda x: x[:])
952+
953+
df3 = df.groupby("g").apply(lambda x: x.copy(deep=False))
954+
955+
df4 = df.groupby("g").apply(lambda x: x.copy(deep=True))
956+
957+
tm.assert_frame_equal(df1, df2)
958+
tm.assert_frame_equal(df2, df3)
959+
tm.assert_frame_equal(df3, df4)

0 commit comments

Comments
 (0)