0

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!

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264

1 Answers1

0

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.

Dishin H Goyani
  • 7,195
  • 3
  • 26
  • 37
mrCopiCat
  • 899
  • 3
  • 15