Most efficient way to reverse a numpy array
Asked 07 September, 2021
Viewed 376 times
  • 57
Votes

Believe it or not, after profiling my current code, the repetitive operation of numpy array reversion ate a giant chunk of the running time. What I have right now is the common view-based method:

reversed_arr = arr[::-1]

Is there any other way to do it more efficiently, or is it just an illusion from my obsession with unrealistic numpy performance?

8 Answer