pop#

MultiBlock.pop(index: Union[int, str] = -1) Optional[Union[MultiBlock, DataSet]][source]#

Pop off a block at the specified index.

Parameters:
indexint or str, optional

Index or name of the dataset within the multiblock. Defaults to last dataset.

Returns:
pyvista.DataSet or pyvista.MultiBlock

Dataset from the given index that was removed.

Examples

Pop the "cube" multiblock.

>>> import pyvista as pv
>>> data = {"cube": pv.Cube(), "sphere": pv.Sphere(center=(2, 2, 0))}
>>> blocks = pv.MultiBlock(data)
>>> blocks.keys()
['cube', 'sphere']
>>> cube = blocks.pop("cube")
>>> blocks.keys()
['sphere']