blosc2.NDArray.slice#
- NDArray.slice(key, **kwargs)#
Get a (multidimensional) slice as a new NDArray.
- Parameters:
- Returns:
out – An array with the requested data. The dtype will be the same as self.
- Return type:
Examples
>>> import blosc2 >>> import numpy as np >>> shape = [23, 11] >>> a = np.arange(np.prod(shape)).reshape(shape) >>> # Create an array >>> b = blosc2.asarray(a) >>> slices = (slice(3, 7), slice(1, 11)) >>> # Get a slice as a new NDArray >>> c = b.slice(slices) >>> c.shape (4, 10)