blosc2.NDArray.squeeze#

NDArray.squeeze(mask=None) NDArray#

Remove single-dimensional entries from the shape of the array.

This method modifies the array in-place. If mask is None removes any dimensions with size 1. If mask is provided, it should be a boolean array of the same shape as the array, and the corresponding dimensions (of size 1) will be removed.

Returns:

out

Return type:

NDArray

Examples

>>> import blosc2
>>> shape = [1, 23, 1, 11, 1]
>>> # Create an array
>>> a = blosc2.full(shape, 2**30)
>>> a.shape
(1, 23, 1, 11, 1)
>>> # Squeeze the array
>>> a.squeeze()
>>> a.shape
(23, 11)