Skip to content

Commit d449ca0

Browse files
remove _cast_values_for_fillna and _fillna_prep
1 parent 078f688 commit d449ca0

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

pandas/core/missing.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@
2323
from pandas._typing import (
2424
ArrayLike,
2525
Axis,
26-
DtypeObj,
2726
)
2827
from pandas.compat._optional import import_optional_dependency
2928

3029
from pandas.core.dtypes.cast import infer_dtype_from
3130
from pandas.core.dtypes.common import (
32-
ensure_float64,
33-
is_integer_dtype,
3431
is_numeric_v_string_like,
3532
needs_i8_conversion,
3633
)
@@ -659,40 +656,6 @@ def interpolate_2d(
659656
return result
660657

661658

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-
696659
def _pad_1d(values, limit=None, mask=None):
697660
if mask is None:
698661
mask = isna(values)

0 commit comments

Comments
 (0)