File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -113,3 +113,21 @@ def test_group_diff_object_raises(object_dtype):
113
113
)
114
114
with pytest .raises (TypeError , match = r"unsupported operand type\(s\) for -" ):
115
115
df .groupby ("a" )["b" ].diff ()
116
+
117
+
118
+ def test_empty_shift_with_fill ():
119
+ # GH 41264, single-index check
120
+ df = DataFrame (columns = ["a" , "b" , "c" ])
121
+ shifted = df .groupby (["a" ]).shift (1 )
122
+ shifted_with_fill = df .groupby (["a" ]).shift (1 , fill_value = 0 )
123
+ tm .assert_frame_equal (shifted , shifted_with_fill )
124
+ tm .assert_index_equal (shifted .index , shifted_with_fill .index )
125
+
126
+
127
+ def test_multindex_empty_shift_with_fill ():
128
+ # GH 41264, multi-index check
129
+ df = DataFrame (columns = ["a" , "b" , "c" ])
130
+ shifted = df .groupby (["a" , "b" ]).shift (1 )
131
+ shifted_with_fill = df .groupby (["a" , "b" ]).shift (1 , fill_value = 0 )
132
+ tm .assert_frame_equal (shifted , shifted_with_fill )
133
+ tm .assert_index_equal (shifted .index , shifted_with_fill .index )
You can’t perform that action at this time.
0 commit comments