Skip to content

Commit f5ca573

Browse files
committed
timedelta fillna check
1 parent b4cf203 commit f5ca573

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/internals.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ def fillna(self, value, **kwargs):
18861886

18871887
# allow filling with integers to be
18881888
# interpreted as seconds
1889-
if not isinstance(value, np.timedelta64):
1889+
if is_integer(value) and not isinstance(value, np.timedelta64):
18901890
value = Timedelta(value, unit='s')
18911891
return super(TimeDeltaBlock, self).fillna(value, **kwargs)
18921892

@@ -1917,11 +1917,11 @@ def _try_coerce_args(self, values, other):
19171917
elif isinstance(other, Timedelta):
19181918
other_mask = isnull(other)
19191919
other = other.value
1920+
elif isinstance(other, timedelta):
1921+
other = Timedelta(other).value
19201922
elif isinstance(other, np.timedelta64):
19211923
other_mask = isnull(other)
19221924
other = Timedelta(other).value
1923-
elif isinstance(other, timedelta):
1924-
other = Timedelta(other).value
19251925
elif hasattr(other, 'dtype') and is_timedelta64_dtype(other):
19261926
other_mask = isnull(other)
19271927
other = other.astype('i8', copy=False).view('i8')

0 commit comments

Comments
 (0)