Skip to content

Commit 5328de9

Browse files
committed
Add test case for GH14927
1 parent b552e28 commit 5328de9

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
@@ -920,3 +920,20 @@ def fast(group):
920920
slow_df = df.groupby("A").apply(slow)
921921

922922
tm.assert_frame_equal(fast_df, slow_df)
923+
924+
925+
def test_gh14927():
926+
# GH 14927
927+
df = pd.DataFrame({"g": [1, 2, 2, 2], "a": [1, 2, 3, 4], "b": [5, 6, 7, 8]})
928+
929+
df1 = df.groupby("g").apply(lambda x: x)
930+
931+
df2 = df.groupby("g").apply(lambda x: x[:])
932+
933+
df3 = df.groupby("g").apply(lambda x: x.copy(deep=False))
934+
935+
df4 = df.groupby("g").apply(lambda x: x.copy(deep=True))
936+
937+
tm.assert_frame_equal(df1, df2)
938+
tm.assert_frame_equal(df2, df3)
939+
tm.assert_frame_equal(df3, df4)

0 commit comments

Comments
 (0)