|
7 | 7 |
|
8 | 8 | import numpy as np
|
9 | 9 |
|
10 |
| -from pandas._libs import algos as libalgos, lib |
| 10 | +from pandas._libs import lib |
11 | 11 | from pandas._typing import ArrayLike, DtypeObj, Hashable
|
12 | 12 | from pandas.util._validators import validate_bool_kwarg
|
13 | 13 |
|
@@ -377,28 +377,9 @@ def shift(self, periods: int, axis: int, fill_value) -> ArrayManager:
|
377 | 377 | )
|
378 | 378 |
|
379 | 379 | def fillna(self, value, limit, inplace: bool, downcast) -> ArrayManager:
|
380 |
| - # TODO implement downcast |
381 |
| - inplace = validate_bool_kwarg(inplace, "inplace") |
382 |
| - |
383 |
| - def array_fillna(array, value, limit, inplace): |
384 |
| - |
385 |
| - mask = isna(array) |
386 |
| - if limit is not None: |
387 |
| - limit = libalgos.validate_limit(None, limit=limit) |
388 |
| - mask[mask.cumsum() > limit] = False |
389 |
| - |
390 |
| - # TODO could optimize for arrays that cannot hold NAs |
391 |
| - # (like _can_hold_na on Blocks) |
392 |
| - if not inplace: |
393 |
| - array = array.copy() |
394 |
| - |
395 |
| - # np.putmask(array, mask, value) |
396 |
| - if np.any(mask): |
397 |
| - # TODO allow invalid value if there is nothing to fill? |
398 |
| - array[mask] = value |
399 |
| - return array |
400 |
| - |
401 |
| - return self.apply(array_fillna, value=value, limit=limit, inplace=inplace) |
| 380 | + return self.apply_with_block( |
| 381 | + "fillna", value=value, limit=limit, inplace=inplace, downcast=downcast |
| 382 | + ) |
402 | 383 |
|
403 | 384 | def downcast(self) -> ArrayManager:
|
404 | 385 | return self.apply_with_block("downcast")
|
@@ -454,7 +435,7 @@ def is_mixed_type(self) -> bool:
|
454 | 435 |
|
455 | 436 | @property
|
456 | 437 | def is_numeric_mixed_type(self) -> bool:
|
457 |
| - return False |
| 438 | + return all(is_numeric_dtype(t) for t in self.get_dtypes()) |
458 | 439 |
|
459 | 440 | @property
|
460 | 441 | def any_extension_types(self) -> bool:
|
|
0 commit comments