NumPy

numpy.nditer.ndim

attribute

nditer.ndim