Numpy Type Annotation
Numpy type annotation
numpy.typing.ArrayLike
is often used on the input variables of a function.
This doesn’t cover all cases a function might accept.
For example, numerous Numpy functions can accept Python
datetime
that becomes an
opaque object
when passed to a function.
It can be better to pass datetime into Numpy functions as numpy.datetime64, which is a subclass of numpy.ndarray and thus can be annotated as numpy.typing.NDArray[numpy.datetime64], especially as the return type of a function.
Currently, Numpy type annotation doesn’t handle the shape of arrays, just the data type.