# numpy.max() in Python | np.max() in Python

Numpy `max()` function is used to get a maximum value along a specified axis.

## Syntax of Numpy.max()

`np.max(a, axis=None)`

`a` parameter refers to the array on which you want to apply np.max() function.

`axis` parameter is optional and helps us to specify the axis on which we want to find the maximum values.

## Python program to find maximum value on 1-Dimensional Numpy Array

```import numpy as np

a = np.array([50, 15, 23, 89, 64])
print('Maximum value in arr: ', np.max(a))```

Output of the above program

`Maximum value in arr: 89`

In 1-Dimensional, it is optional to pass axis parameter to np.max() function. ## Python program to find maximum value on 2-Dimensional Numpy Array

```import numpy as np

a = np.array([[50, 15, 89, 23, 64],
[45, 98, 25, 17, 55],
[35, 37, 9, 100, 61]])
print('Maximum value in arr: ', np.max(a))
print('Maximum value in arr along axis 0: ', np.max(a, axis=0))
print('Maximum value in arr along axis 1: ', np.max(a, axis=1))```

Output of the above program

```Maximum value in arr:  100
Maximum value in arr along axis 0:  [ 50  98  89 100  64]
Maximum value in arr along axis 1:  [ 89  98 100]```

When axis value is not passed to max() function, then it returns the maximum element present in the array- When `axis=0` is passed to max() function, then it works like this- When `axis=1` is passed to max() function, then it works like this- 