>>> a = np.array([[1,2], [3,4]])
>>> a.flatten()
array([1, 2, 3, 4])
>>> a.flatten('F')
array([1, 3, 2, 4])
import numpy as np
List = np.array([[1,2,3], [4,5,6], [7,8,9]])
result = List.flatten()
print(result)
# welcome to softhunt.net
# Python program explaining
# numpy.ndarray.flatten() function
# importing numpy as np
import numpy as np
arr = np.array([[2, 3], [4, 5]])
softhunt = arr.flatten()
print( softhunt )
import numpy as np
List = np.array([[1,2,3], [4,5,6], [7,8,9]])
print(list(List.flat))
numpy.ndarray.flatten(order=’C’)
import numpy as np
List = np.array([[1,2,3], [4,5,6], [7,8,9]])
result = List.ravel()
print(result)