blosc2.NDArray.__getitem__#
- NDArray.__getitem__(key: int | slice | Sequence[slice]) ndarray #
Get a (multidimensional) slice as specified in key.
- Parameters:
key¶ (int, slice or sequence of slices) – The slice(s) to be retrieved. Note that step parameter is not honored yet in slices.
- Returns:
out – An array with the requested data.
- Return type:
np.ndarray
Examples
>>> import blosc2 >>> shape = [25, 10] >>> # Create an array >>> a = blosc2.full(shape, 3.3333) >>> # Get slice as a NumPy array >>> a[:5, :5] array([[3.3333, 3.3333, 3.3333, 3.3333, 3.3333], [3.3333, 3.3333, 3.3333, 3.3333, 3.3333], [3.3333, 3.3333, 3.3333, 3.3333, 3.3333], [3.3333, 3.3333, 3.3333, 3.3333, 3.3333], [3.3333, 3.3333, 3.3333, 3.3333, 3.3333]])