Skip to content

Commit a35f93c

Browse files
committed
Just apply to objects
1 parent a609f48 commit a35f93c

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

pandas/core/arrays/base.py

+3-12
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,10 @@ def fillna(self, value=None, method=None, limit=None):
279279

280280
if mask.any():
281281
if method is not None:
282-
# ffill / bfill
283-
# The basic idea is to create an array of integer positions.
284-
# Internally, we use iNaT and the datetime filling routines
285-
# to avoid floating-point NaN. Once filled, we take on `self`
286-
# to get the actual values.
287282
func = pad_1d if method == 'pad' else backfill_1d
288-
idx = np.arange(len(self), dtype='int64')
289-
idx[mask] = iNaT
290-
idx = _ensure_platform_int(func(idx, mask=mask,
291-
limit=limit,
292-
dtype='datetime64[ns]'))
293-
idx[idx == iNaT] = -1 # missing value marker for take.
294-
new_values = self.take(idx)
283+
new_values = func(self.astype(object), limit=limit,
284+
mask=mask)
285+
new_values = self._constructor_from_sequence(new_values)
295286
else:
296287
# fill with value
297288
new_values = self.copy()

0 commit comments

Comments
 (0)