ndarray.flat
The ndarray.flat attribute takes no parameter values since it is an attribute. It only goes with the index number of the element of the array in a square bracket, [ ].
The ndarray.flat attribute returns a 1-D iterator over the input array.
import numpy as np# creating an input arraymyarray = np.array([1, 2, 3, 4, 5, 6, 7, 8])# getting the ndarray.flat attribute of the elementi in index 5print(myarray.flat[5])
numpy module.myarray , using the array() function.5 using the ndarray.flat attribute.