numpy.dtype.ndim

attribute

dtype.ndim

Number of dimensions of the sub-array if this data type describes a sub-array, and 0 otherwise.

1.13.0 新版功能.