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

Method to_2d_mgr

pandas/core/internals/managers.py:2065–2074  ·  view source on GitHub ↗

Manager analogue of Series.to_frame

(self, columns: Index)

Source from the content-addressed store, hash-verified

2063 return cls(block, index)
2064
2065 def to_2d_mgr(self, columns: Index) -> BlockManager:
2066 """
2067 Manager analogue of Series.to_frame
2068 """
2069 blk = self.blocks[0]
2070 arr = ensure_block_shape(blk.values, ndim=2)
2071 bp = BlockPlacement(0)
2072 new_blk = type(blk)(arr, placement=bp, ndim=2, refs=blk.refs)
2073 axes = [columns, self.axes[0].view()]
2074 return BlockManager([new_blk], axes=axes, verify_integrity=False)
2075
2076 def _has_no_reference(self, i: int = 0) -> bool:
2077 """

Callers 1

to_frameMethod · 0.80

Calls 3

ensure_block_shapeFunction · 0.90
BlockManagerClass · 0.85
viewMethod · 0.45

Tested by

no test coverage detected