np.max is just an alias for np.amax. This function only works on a single input array and finds the value of maximum element in that entire array (returning a scalar). Alternatively, it takes an axis argument and will find the maximum value along an axis of the input array (returning a new array).

>>> a = np.array([[0, 1, 6],
                  [2, 4, 1]])
>>> np.max(a)
6
>>> np.max(a, axis=0) # max of each column
array([2, 4, 6])

The default behaviour of np.maximum is to take two arrays and compute their element-wise maximum. Here, 'compatible' means that one array can be broadcast to the other. For example:

>>> b = np.array([3, 6, 1])
>>> c = np.array([4, 2, 9])
>>> np.maximum(b, c)
array([4, 6, 9])

But np.maximum is also a universal function which means that it has other features and methods which come in useful when working with multidimensional arrays. For example you can compute the cumulative maximum over an array (or a particular axis of the array):

>>> d = np.array([2, 0, 3, -4, -2, 7, 9])
>>> np.maximum.accumulate(d)
array([2, 2, 3, 3, 3, 7, 9])

This is not possible with np.max.

You can make np.maximum imitate np.max to a certain extent when using np.maximum.reduce:

>>> np.maximum.reduce(d)
9
>>> np.max(d)
9

Basic testing suggests the two approaches are comparable in performance; and they should be, as np.max() actually calls np.maximum.reduce to do the computation.

Answer from Alex Riley on Stack Overflow
Top answer
1 of 4
260

np.max is just an alias for np.amax. This function only works on a single input array and finds the value of maximum element in that entire array (returning a scalar). Alternatively, it takes an axis argument and will find the maximum value along an axis of the input array (returning a new array).

>>> a = np.array([[0, 1, 6],
                  [2, 4, 1]])
>>> np.max(a)
6
>>> np.max(a, axis=0) # max of each column
array([2, 4, 6])

The default behaviour of np.maximum is to take two arrays and compute their element-wise maximum. Here, 'compatible' means that one array can be broadcast to the other. For example:

>>> b = np.array([3, 6, 1])
>>> c = np.array([4, 2, 9])
>>> np.maximum(b, c)
array([4, 6, 9])

But np.maximum is also a universal function which means that it has other features and methods which come in useful when working with multidimensional arrays. For example you can compute the cumulative maximum over an array (or a particular axis of the array):

>>> d = np.array([2, 0, 3, -4, -2, 7, 9])
>>> np.maximum.accumulate(d)
array([2, 2, 3, 3, 3, 7, 9])

This is not possible with np.max.

You can make np.maximum imitate np.max to a certain extent when using np.maximum.reduce:

>>> np.maximum.reduce(d)
9
>>> np.max(d)
9

Basic testing suggests the two approaches are comparable in performance; and they should be, as np.max() actually calls np.maximum.reduce to do the computation.

2 of 4
26

You've already stated why np.maximum is different - it returns an array that is the element-wise maximum between two arrays.

As for np.amax and np.max: they both call the same function - np.max is just an alias for np.amax, and they compute the maximum of all elements in an array, or along an axis of an array.

In [1]: import numpy as np

In [2]: np.amax
Out[2]: <function numpy.core.fromnumeric.amax>

In [3]: np.max
Out[3]: <function numpy.core.fromnumeric.amax>
🌐
Real Python
realpython.com › numpy-max-maximum
NumPy's max() and maximum(): Find Extreme Values in Arrays – Real Python
January 18, 2025 - For the rest of this tutorial, max() will always refer to the NumPy version. np.max() is the tool that you need for finding the maximum value or values in a single array.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.max.html
numpy.max — NumPy v2.2 Manual
Notice that the initial value is used as one of the elements for which the maximum is determined, unlike for the default argument Python’s max function, which is only used for empty iterables.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.maximum.html
numpy.maximum — NumPy v2.2 Manual
Element-wise maximum of array elements · Compare two arrays and return a new array containing the element-wise maxima. If one of the elements being compared is a NaN, then that element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for ...
🌐
Medium
medium.com › @amit25173 › understanding-element-wise-maximum-in-numpy-43916b1c2002
Understanding Element-wise Maximum in NumPy | by Amit Yadav | Medium
March 6, 2025 - Here, NumPy broadcasts arr2 to match the shape of arr1. It’s like stretching a small array to fit a larger one. ... arr1 = np.array([[1, 2], [3, 4]]) arr2 = np.array([5, 6, 7]) # Incompatible shape # This will raise a ValueError # result = np.maximum(arr1, arr2) So, always make sure the shapes are either the same or broadcastable. Use np.maximum() for arrays, not max().
🌐
IncludeHelp
includehelp.com › python › numpy-max-or-max-which-one-is-faster.aspx
Python - numpy.max() or max(), which one is faster?
December 25, 2023 - In terms of speed, both numpy.max() and arr.max() work similarly, however, max(arr) works much faster than these two methods.
🌐
DataCamp
datacamp.com › doc › numpy › max
NumPy max()
The `max()` function is used to compute the maximum value of elements in a NumPy array either globally or along a specific axis.
Find elsewhere
🌐
Codecademy
codecademy.com › docs › python:numpy › built-in functions › .max()
Python:NumPy | Built-in Functions | .max() | Codecademy
July 2, 2025 - The .max() function in NumPy returns the maximum value of an array or the maximum values along a specified axis. This function is essential for data analysis, statistical computations, and finding peak values in datasets.
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.max.html
numpy.max — NumPy v2.4 Manual
Notice that the initial value is used as one of the elements for which the maximum is determined, unlike for the default argument Python’s max function, which is only used for empty iterables.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-maximum-in-python
numpy.maximum() in Python - GeeksforGeeks
December 19, 2025 - import numpy as np a = np.array([2, 8, 125]) b = np.array([3, 3, 15]) print(np.maximum(a, b)) Output · [ 3 8 125] Explanation: np.maximum(a, b) compares each index, max(2, 3) -> 3, max(8, 3) -> 8 and max(125, 15) -> 125. Example 2: This example shows how numpy.maximum() behaves when the arrays contain NaN values.
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.maximum.html
numpy.maximum — NumPy v2.4 Manual
June 22, 2021 - Element-wise maximum of array elements · Compare two arrays and return a new array containing the element-wise maxima. If one of the elements being compared is a NaN, then that element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for ...
🌐
CSDN
devpress.csdn.net › python › 62fcffdc7e668234661912ab.html
numpy max vs amax vs maximum - DevPress官方社区- CSDN
August 17, 2022 - Answer a question numpy has three different functions which seem like they can be used for the same things --- except that numpy.maximum can only be used element-wise, while numpy.max and numpy.amax c Mangs Python
🌐
TestMu AI Community
community.testmu.ai › ask a question
How does np.max differ from np.amax and np.maximum, and why does NumPy include all three? - TestMu AI Community
June 13, 2025 - 👋 I’ve been diving deeper into NumPy’s functions lately, trying to get a clearer picture of their intended uses and performance nuances. It’s always fascinating to uncover the design decisions behind such powerful libraries. I’ve come across an interesting trio of functions, np.max, np.amax, and np.maximum...
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.amax.html
numpy.amax — NumPy v2.1 Manual
Return the maximum of an array or maximum along an axis · amax is an alias of max
🌐
Educative
educative.io › answers › what-is-numpymaximum-in-python
What is numpy.maximum() in Python?
Python’s numpy.maximum() computes the element-wise maximum of an array. It compares two arrays and returns a new array containing the maximum values.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.max.html
numpy.max — NumPy v2.5.dev0 Manual
Notice that the initial value is used as one of the elements for which the maximum is determined, unlike for the default argument Python’s max function, which is only used for empty iterables.
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.argmax.html
numpy.argmax — NumPy v2.3 Manual
Apply np.expand_dims(index_array, axis) from argmax to an array as if by calling max. Notes · In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence are returned. Examples · Try it in your browser! >>> import numpy as np >>> a = np.arange(6).reshape(2,3) + 10 >>> a array([[10, 11, 12], [13, 14, 15]]) >>> np.argmax(a) 5 >>> np.argmax(a, axis=0) array([1, 1, 1]) >>> np.argmax(a, axis=1) array([2, 2]) Indexes of the maximal elements of a N-dimensional array: >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) >>> ind (1, 2) >>> a[ind] 15 ·
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.amax.html
numpy.amax — NumPy v2.4 Manual
Return the maximum of an array or maximum along an axis · amax is an alias of max
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.max.html
numpy.max — NumPy v2.1 Manual
Notice that the initial value is used as one of the elements for which the maximum is determined, unlike for the default argument Python’s max function, which is only used for empty iterables.