# Reverse Numpy arrays

## Reverse 1 dimensional numpy  arrays  using reverse slicing [ : :-1]

Reverse N dimensional numpy arrays row wise using “fliplr” method

## Reverse N dimensional numpy array column wise using “flipud”  method

```# Imports
import numpy as np

# Let's create numpy arrays
nparray = np.array([1, 2, 3, 4])
nparraynd = np.array([[1, 2, 4],[0, 3, 5],[8, 9, 7]])

# Reverse 1 dim array
reversedarray = nparray[::-1]

print("Original array: \n{}\n".format(nparray))
print("Reversed 1 dim array: \n{}\n".format(reversedarray))
```
```Original array:
[1 2 3 4]

Reversed 1 dim array:
[4 3 2 1]

```
```# Reverse N dim array row wise
rowrevndarray = np.fliplr(nparraynd)

print("Original array: \n{}\n".format(nparraynd))
print("N dim array row reversed: \n{}\n".format(rowrevndarray))
```
```Original array:
[[1 2 4]
[0 3 5]
[8 9 7]]

N dim array row reversed:
[[4 2 1]
[5 3 0]
[7 9 8]]

```
```# Reverse N dim array column wise
colrevndarray = np.flipud(nparraynd)

print("Original array: \n{}\n".format(nparraynd))
print("N dim array column reversed: \n{}\n".format(colrevndarray))
```
```Original array:
[[1 2 4]
[0 3 5]
[8 9 7]]

N dim array column reversed:
[[8 9 7]
[0 3 5]
[1 2 4]]

```
```# Reverse N dim array element wise
elerevndarray = np.fliplr(nparraynd)[::-1]

print("Original array: \n{}\n".format(nparraynd))
print("N dim array element wise reversed: \n{}\n".format(elerevndarray))
```
```Original array:
[[1 2 4]
[0 3 5]
[8 9 7]]

N dim array element wise reversed:
[[7 9 8]
[5 3 0]
[4 2 1]]

```