I have an np array with 3 rows.
Is there any easy way to put the first row to the second and the second to first?
I am a beginner to python so I am struggling a little bit
thanks!
I have an np array with 3 rows.
Is there any easy way to put the first row to the second and the second to first?
I am a beginner to python so I am struggling a little bit
thanks!
You can use this :
arr[[0, 1]] = arr[[1, 0]]
Instead of the first 0
and the second row 1
, you can switch any rows with that.