numpy.lib.Arrayterator.flat#
property
- property lib.Arrayterator.flat#
Arrayterator 对象的 1-D 平面迭代器.
这个迭代器在 Arrayterator 中一次返回要迭代的数组的元素.它类似于 flatiter.
示例
>>> a = np.arange(3 * 4 * 5 * 6).reshape(3, 4, 5, 6) >>> a_itor = np.lib.Arrayterator(a, 2)
>>> for subarr in a_itor.flat: ... if not subarr: ... print(subarr, type(subarr)) ... 0 <class 'numpy.int64'>