Numpy-ndarray-flat
提供:Dev Guides
numpy.ndarray.flat
この関数は、配列の1次元反復子を返します。 Pythonの組み込みイテレータと同様に動作します。
例
import numpy as np
a = np.arange(8).reshape(2,4)
print 'The original array:'
print a
print '\n'
print 'After applying the flat function:'
# returns element corresponding to index in flattened array
print a.flat[5]
その出力は次のとおりです-
The original array:
[[After applying the flat function:
5