@@ -250,6 +250,42 @@ def test_ser_div_ser(self, dtype1, dtype2):
250
250
tm .assert_series_equal (result , expected )
251
251
assert not result .equals (second / first )
252
252
253
+ @pytest .mark .parametrize ('dtype2' , [
254
+ np .int64 , np .int32 , np .int16 , np .int8 ,
255
+ np .float64 , np .float32 , np .float16 ,
256
+ np .uint64 , np .uint32 , np .uint16 , np .uint8 ])
257
+ @pytest .mark .parametrize ('dtype1' , [np .int64 , np .float64 , np .uint64 ])
258
+ def test_ser_divmod_zero (self , dtype1 , dtype2 ):
259
+ # GH#26987
260
+ left = pd .Series ([1 , 1 ]).astype (dtype1 )
261
+ right = pd .Series ([0 , 2 ]).astype (dtype2 )
262
+
263
+ expected = left // right , left % right
264
+ result = divmod (left , right )
265
+
266
+ tm .assert_series_equal (result [0 ], expected [0 ])
267
+ tm .assert_series_equal (result [1 ], expected [1 ])
268
+
269
+ # rdivmod case
270
+ result = divmod (left .values , right )
271
+ tm .assert_series_equal (result [0 ], expected [0 ])
272
+ tm .assert_series_equal (result [1 ], expected [1 ])
273
+
274
+ def test_ser_divmod_inf (self ):
275
+ left = pd .Series ([np .inf , 1. ])
276
+ right = pd .Series ([np .inf , 2. ])
277
+
278
+ expected = left // right , left % right
279
+ result = divmod (left , right )
280
+
281
+ tm .assert_series_equal (result [0 ], expected [0 ])
282
+ tm .assert_series_equal (result [1 ], expected [1 ])
283
+
284
+ # rdivmod case
285
+ result = divmod (left .values , right )
286
+ tm .assert_series_equal (result [0 ], expected [0 ])
287
+ tm .assert_series_equal (result [1 ], expected [1 ])
288
+
253
289
def test_rdiv_zero_compat (self ):
254
290
# GH#8674
255
291
zero_array = np .array ([0 ] * 5 )
0 commit comments