SciPy

numpy.nditer.ndim

attribute

nditer.ndim