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

Method pad_or_backfill

pandas/core/internals/blocks.py:1347–1372  ·  view source on GitHub ↗
(
        self,
        *,
        method: FillnaOptions,
        inplace: bool = False,
        limit: int | None = None,
        limit_area: Literal["inside", "outside"] | None = None,
    )

Source from the content-addressed store, hash-verified

1345 return extend_blocks(nbs)
1346
1347 def pad_or_backfill(
1348 self,
1349 *,
1350 method: FillnaOptions,
1351 inplace: bool = False,
1352 limit: int | None = None,
1353 limit_area: Literal["inside", "outside"] | None = None,
1354 ) -> list[Block]:
1355 if not self._can_hold_na:
1356 # If there are no NAs, then interpolate is a no-op
1357 return [self.copy(deep=False)]
1358
1359 copy, refs = self._get_refs_and_copy(inplace)
1360
1361 # Dispatch to the NumpyExtensionArray method.
1362 # We know self.array_values is a NumpyExtensionArray bc EABlock overrides
1363 vals = cast(NumpyExtensionArray, self.array_values)
1364 new_values = vals.T._pad_or_backfill(
1365 method=method,
1366 limit=limit,
1367 limit_area=limit_area,
1368 copy=copy,
1369 ).T
1370
1371 data = extract_array(new_values, extract_numpy=True)
1372 return [self.make_block_same_class(data, refs=refs)]
1373
1374 @final
1375 def interpolate(

Callers 1

_pad_or_backfillMethod · 0.45

Calls 5

copyMethod · 0.95
_get_refs_and_copyMethod · 0.95
make_block_same_classMethod · 0.95
extract_arrayFunction · 0.90
_pad_or_backfillMethod · 0.45

Tested by

no test coverage detected