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

Method split_and_operate

pandas/core/internals/blocks.py:404–424  ·  view source on GitHub ↗

Split the block and apply func column-by-column. Parameters ---------- func : Block method *args **kwargs Returns ------- List[Block]

(self, func, *args, **kwargs)

Source from the content-addressed store, hash-verified

402
403 @final
404 def split_and_operate(self, func, *args, **kwargs) -> list[Block]:
405 """
406 Split the block and apply func column-by-column.
407
408 Parameters
409 ----------
410 func : Block method
411 *args
412 **kwargs
413
414 Returns
415 -------
416 List[Block]
417 """
418 assert self.ndim == 2 and self.shape[0] != 1
419
420 res_blocks = []
421 for nb in self._split():
422 rbs = func(nb, *args, **kwargs)
423 res_blocks.extend(rbs)
424 return res_blocks
425
426 # ---------------------------------------------------------------------
427 # Up/Down-casting

Callers 1

convertMethod · 0.95

Calls 2

_splitMethod · 0.95
funcFunction · 0.50

Tested by

no test coverage detected