Given that i have a 2d array and i want to reshape it to 1d with one value per row

  numpy, python, reshape

This is my array

arr = np.array([[0, 1],
[3, 4],
[6, 7]])

flat_arr = np.reshape(arr, -1)

am getting the following result:

[0 1 2 3 4 5 6 7 8]

my desired result is :

[0]
[1]
[3]
[4]
[5]...

Source: Python Questions

LEAVE A COMMENT