Skip to main content
`Ctrl`+`K`

# numpy.ndarray.__class_getitem__

method

classmethod ndarray.__class_getitem__(item, /)

  Return a parametrized wrapper around the `ndarray` type.

  Added in version 1.22.

  Returns:
    alias types.GenericAlias

      A parametrized `ndarray` type.

  See also

  PEP 585

    Type hinting generics in standard collections.

  `numpy.typing.NDArray`

    An ndarray alias generic w.r.t. its `dtype.type`.

  Examples

      >>> from typing import Any
      >>> import numpy as np

      >>> np.ndarray[Any, np.dtype[np.uint8]]
      numpy.ndarray[typing.Any, numpy.dtype[numpy.uint8]]