Skip to content

Commit ad1ec2f

Browse files
committed
Add test case for GH14927
1 parent edefc27 commit ad1ec2f

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

872872
tm.assert_frame_equal(fast_df, slow_df)
873+
874+
875+
def test_gh14927():
876+
# GH 14927
877+
df = pd.DataFrame({"g": [1, 2, 2, 2], "a": [1, 2, 3, 4], "b": [5, 6, 7, 8]})
878+
879+
df1 = df.groupby("g").apply(lambda x: x)
880+
881+
df2 = df.groupby("g").apply(lambda x: x[:])
882+
883+
df3 = df.groupby("g").apply(lambda x: x.copy(deep=False))
884+
885+
df4 = df.groupby("g").apply(lambda x: x.copy(deep=True))
886+
887+
tm.assert_frame_equal(df1, df2)
888+
tm.assert_frame_equal(df2, df3)
889+
tm.assert_frame_equal(df3, df4)

0 commit comments

Comments
 (0)