Skip to content

Commit 62f2291

Browse files
jbrockmendelKevin D Smith
authored and
Kevin D Smith
committed
BUG: ndarray[td64] // TimedeltaArray (pandas-dev#36646)
1 parent 4bab74c commit 62f2291

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pandas/core/arrays/timedeltas.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -689,13 +689,12 @@ def __rfloordiv__(self, other):
689689

690690
elif is_timedelta64_dtype(other.dtype):
691691
other = type(self)(other)
692-
693692
# numpy timedelta64 does not natively support floordiv, so operate
694693
# on the i8 values
695694
result = other.asi8 // self.asi8
696695
mask = self._isnan | other._isnan
697696
if mask.any():
698-
result = result.astype(np.int64)
697+
result = result.astype(np.float64)
699698
result[mask] = np.nan
700699
return result
701700

pandas/tests/arithmetic/test_timedelta64.py

+4
Original file line numberDiff line numberDiff line change
@@ -1750,6 +1750,10 @@ def test_td64arr_floordiv_td64arr_with_nat(self, box_with_array):
17501750

17511751
tm.assert_equal(result, expected)
17521752

1753+
# case that goes through __rfloordiv__ with arraylike
1754+
result = np.asarray(left) // right
1755+
tm.assert_equal(result, expected)
1756+
17531757
def test_td64arr_floordiv_tdscalar(self, box_with_array, scalar_td):
17541758
# GH#18831
17551759
td1 = Series([timedelta(minutes=5, seconds=3)] * 3)

0 commit comments

Comments
 (0)