MCPcopy
hub / github.com/pandas-dev/pandas / _pad_or_backfill

Method _pad_or_backfill

pandas/core/generic.py:6884–6919  ·  view source on GitHub ↗
(
        self,
        method: Literal["ffill", "bfill", "pad", "backfill"],
        *,
        axis: None | Axis = None,
        inplace: bool = False,
        limit: None | int = None,
        limit_area: Literal["inside", "outside"] | None = None,
    )

Source from the content-addressed store, hash-verified

6882
6883 @final
6884 def _pad_or_backfill(
6885 self,
6886 method: Literal["ffill", "bfill", "pad", "backfill"],
6887 *,
6888 axis: None | Axis = None,
6889 inplace: bool = False,
6890 limit: None | int = None,
6891 limit_area: Literal["inside", "outside"] | None = None,
6892 ):
6893 if axis is None:
6894 axis = 0
6895 axis = self._get_axis_number(axis)
6896 method = clean_fill_method(method)
6897
6898 if axis == 1:
6899 if not self._mgr.is_single_block and inplace:
6900 raise NotImplementedError
6901 # e.g. test_align_fill_method
6902 result = self.T._pad_or_backfill(
6903 method=method, limit=limit, limit_area=limit_area
6904 ).T
6905
6906 return result
6907
6908 new_mgr = self._mgr.pad_or_backfill(
6909 method=method,
6910 limit=limit,
6911 limit_area=limit_area,
6912 inplace=inplace,
6913 )
6914 result = self._constructor_from_mgr(new_mgr, axes=new_mgr.axes)
6915 if inplace:
6916 self._update_inplace(result)
6917 return self
6918 else:
6919 return result.__finalize__(self, method="fillna")
6920
6921 @final
6922 def fillna(

Callers 2

ffillMethod · 0.95
bfillMethod · 0.95

Calls 6

_get_axis_numberMethod · 0.95
_update_inplaceMethod · 0.95
clean_fill_methodFunction · 0.90
__finalize__Method · 0.80
pad_or_backfillMethod · 0.45
_constructor_from_mgrMethod · 0.45

Tested by

no test coverage detected