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

Method _split

pandas/core/internals/blocks.py:390–401  ·  view source on GitHub ↗

Split a block into a list of single-column blocks.

(self)

Source from the content-addressed store, hash-verified

388
389 @final
390 def _split(self) -> Generator[Block]:
391 """
392 Split a block into a list of single-column blocks.
393 """
394 assert self.ndim == 2
395
396 for i, ref_loc in enumerate(self._mgr_locs):
397 vals = self.values[slice(i, i + 1)]
398
399 bp = BlockPlacement(ref_loc)
400 nb = type(self)(vals, placement=bp, ndim=2, refs=self.refs)
401 yield nb
402
403 @final
404 def split_and_operate(self, func, *args, **kwargs) -> list[Block]:

Callers 10

split_and_operateMethod · 0.95
replaceMethod · 0.95
putmaskMethod · 0.95
whereMethod · 0.95
convert_dtypesMethod · 0.80
whereMethod · 0.80
putmaskMethod · 0.80
get_bool_dataMethod · 0.80
grouped_reduceMethod · 0.80
test_splitMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_splitMethod · 0.64