|
39 | 39 | is_datetime64tz_dtype,
|
40 | 40 | is_dtype_equal,
|
41 | 41 | is_extension_array_dtype,
|
42 |
| - is_integer, |
43 | 42 | is_list_like,
|
44 | 43 | is_object_dtype,
|
45 | 44 | is_sparse,
|
@@ -442,8 +441,7 @@ def fillna(
|
442 | 441 | if self._can_hold_element(value):
|
443 | 442 | nb = self if inplace else self.copy()
|
444 | 443 | putmask_inplace(nb.values, mask, value)
|
445 |
| - # TODO: should be nb._maybe_downcast? |
446 |
| - return self._maybe_downcast([nb], downcast) |
| 444 | + return nb._maybe_downcast([nb], downcast) |
447 | 445 |
|
448 | 446 | if noop:
|
449 | 447 | # we can't process the value, but nothing to do
|
@@ -2160,10 +2158,8 @@ def get_values(self, dtype: Optional[DtypeObj] = None) -> np.ndarray:
|
2160 | 2158 | def external_values(self):
|
2161 | 2159 | # NB: this is different from np.asarray(self.values), since that
|
2162 | 2160 | # return an object-dtype ndarray of Timestamps.
|
2163 |
| - if self.is_datetimetz: |
2164 |
| - # avoid FutureWarning in .astype in casting from dt64t to dt64 |
2165 |
| - return self.values._data |
2166 |
| - return np.asarray(self.values.astype("datetime64[ns]", copy=False)) |
| 2161 | + # avoid FutureWarning in .astype in casting from dt64t to dt64 |
| 2162 | + return self.values._data |
2167 | 2163 |
|
2168 | 2164 | def fillna(
|
2169 | 2165 | self, value, limit=None, inplace: bool = False, downcast=None
|
@@ -2228,16 +2224,10 @@ def _holder(self):
|
2228 | 2224 | def fillna(
|
2229 | 2225 | self, value, limit=None, inplace: bool = False, downcast=None
|
2230 | 2226 | ) -> List[Block]:
|
2231 |
| - # TODO(EA2D): if we operated on array_values, TDA.fillna would handle |
2232 |
| - # raising here. |
2233 |
| - if is_integer(value): |
2234 |
| - # Deprecation GH#24694, GH#19233 |
2235 |
| - raise TypeError( |
2236 |
| - "Passing integers to fillna for timedelta64[ns] dtype is no " |
2237 |
| - "longer supported. To obtain the old behavior, pass " |
2238 |
| - "`pd.Timedelta(seconds=n)` instead." |
2239 |
| - ) |
2240 |
| - return super().fillna(value, limit=limit, inplace=inplace, downcast=downcast) |
| 2227 | + values = self.array_values() |
| 2228 | + values = values if inplace else values.copy() |
| 2229 | + new_values = values.fillna(value=value, limit=limit) |
| 2230 | + return [self.make_block_same_class(values=new_values)] |
2241 | 2231 |
|
2242 | 2232 |
|
2243 | 2233 | class ObjectBlock(Block):
|
|
0 commit comments