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
  • 95,415
  • 23
  • 151
  • 231

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
  • 6,501
  • 3
  • 23
  • 34
mrCopiCat
  • 376
  • 1
  • 8