1

I have a simple 1d np.array.

Is there any built in functions to reverse it?

for example a = [0, 1, 2, 3] with a = [3, 2, 1, 0]?

Thanks

Gabriele

spec3
  • 445
  • 1
  • 7
  • 14

1 Answers1

1

It is the same as for the regular arrays:

b = a[::-1]

Note, that it creates a view on the array. If you change the original array, the reversed one will reflect it.

Ishamael
  • 12,123
  • 4
  • 31
  • 50