Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 510 Bytes

how-to-reverse-array.md

File metadata and controls

27 lines (20 loc) · 510 Bytes

How to reverse Numpy array

import numpy as np
a = np.array([1, 2, 3, 4, 5])

flipped = np.flip(a)
  • import numpy as np - load lib:Numpy module for Python
  • np.array - declare Numpy array
  • np.flip - reverse specified array
  • flipped - will contain reversed a array

Example:

import numpy as np
a = np.array([1, 2, 3, 4, 5])

print(np.flip(a))
[5 4 3 2 1]

link_youtube: https://youtu.be/zNlWerwmhns