|
23 | 23 | from pandas._typing import (
|
24 | 24 | ArrayLike,
|
25 | 25 | Axis,
|
26 |
| - DtypeObj, |
27 | 26 | )
|
28 | 27 | from pandas.compat._optional import import_optional_dependency
|
29 | 28 |
|
30 | 29 | from pandas.core.dtypes.cast import infer_dtype_from
|
31 | 30 | from pandas.core.dtypes.common import (
|
32 |
| - ensure_float64, |
33 |
| - is_integer_dtype, |
34 | 31 | is_numeric_v_string_like,
|
35 | 32 | needs_i8_conversion,
|
36 | 33 | )
|
@@ -659,40 +656,6 @@ def interpolate_2d(
|
659 | 656 | return result
|
660 | 657 |
|
661 | 658 |
|
662 |
| -def _cast_values_for_fillna(values, dtype: DtypeObj, has_mask: bool): |
663 |
| - """ |
664 |
| - Cast values to a dtype that algos.pad and algos.backfill can handle. |
665 |
| - """ |
666 |
| - # TODO: for int-dtypes we make a copy, but for everything else this |
667 |
| - # alters the values in-place. Is this intentional? |
668 |
| - |
669 |
| - if needs_i8_conversion(dtype): |
670 |
| - values = values.view(np.int64) |
671 |
| - |
672 |
| - elif is_integer_dtype(values) and not has_mask: |
673 |
| - # NB: this check needs to come after the datetime64 check above |
674 |
| - # has_mask check to avoid casting i8 values that have already |
675 |
| - # been cast from PeriodDtype |
676 |
| - values = ensure_float64(values) |
677 |
| - |
678 |
| - return values |
679 |
| - |
680 |
| - |
681 |
| -def _fillna_prep(values, mask=None): |
682 |
| - # boilerplate for _pad_1d, _backfill_1d, _pad_2d, _backfill_2d |
683 |
| - dtype = values.dtype |
684 |
| - |
685 |
| - has_mask = mask is not None |
686 |
| - if not has_mask: |
687 |
| - # This needs to occur before datetime/timedeltas are cast to int64 |
688 |
| - mask = isna(values) |
689 |
| - |
690 |
| - values = _cast_values_for_fillna(values, dtype, has_mask) |
691 |
| - |
692 |
| - mask = mask.view(np.uint8) |
693 |
| - return values, mask |
694 |
| - |
695 |
| - |
696 | 659 | def _pad_1d(values, limit=None, mask=None):
|
697 | 660 | if mask is None:
|
698 | 661 | mask = isna(values)
|
|
0 commit comments