You can use np.ufunc.reduce with multiple axis to get as array as you want.

(first find max on axis=1 from X1 , X2 then find max on axis=0 from result.)

np.maximum.reduce([X1, X2], axis=(1,0))
# array([4633.70349825])

np.minimum.reduce([X1, X2], axis=(1,0))
# array([319.09009796])

Or try this to get as value:

>>> np.max((X1,X2))
4633.70349825

>>> np.min((X1,X2))
319.09009796

Or try this to get as array:

>>> max(max(X1), max(X2))
array([4633.70349825])

>>> min(min(X1), min(X2))
array([319.09009796])
Answer from Mahdi F. on Stack Overflow
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.max.html
numpy.max — NumPy v2.5.dev0 Manual
The maximum value of an array along a given axis, ignoring any NaNs. ... Element-wise maximum of two arrays, propagating any NaNs.
🌐
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 ...
🌐
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 ...
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.max.html
numpy.max — NumPy v2.2 Manual
The maximum value of an array along a given axis, ignoring any NaNs. ... Element-wise maximum of two arrays, propagating any NaNs.
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › maximum
Python Numpy maximum() - Find Maximum Value | Vultr Docs
November 18, 2024 - Use numpy.maximum() to compare two arrays element-wise and find the maximum value of each position.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-maximum-in-python
numpy.maximum() in Python - GeeksforGeeks
December 19, 2025 - numpy.maximum() is a NumPy function that compares two arrays (or scalars) element-wise and returns a new array containing the maximum value at each position. If any compared element is NaN, the NaN is returned.
🌐
Programiz
programiz.com › python-programming › numpy › methods › maximum
NumPy maximum() (With Examples)
The maximum() function returns an array containing element-wise maximum of two arrays. import numpy as np # create two 2-D arrays array1 = np.array([[1, 2, 3], [4, 5, 6]]) array2 = np.array([[2, 4, 1], [5, 3, 2]])
Find elsewhere
🌐
Real Python
realpython.com › numpy-max-maximum
NumPy's max() and maximum(): Find Extreme Values in Arrays – Real Python
January 18, 2025 - NumPy’s max() function finds the maximum value within a single array, working with both one-dimensional and multi-dimensional arrays. Conversely, np.maximum() compares two arrays element-wise to find the maximum values.
🌐
Moonbooks
en.moonbooks.org › Articles › How-to-only-keep-the-maximum-value-element-wise-when-comparing-two-numpy-arrays-
How to only keep the maximum value of two numpy arrays ?
December 8, 2023 - One way to only keep the maximum value element-wise is to use the np.maximum() function. This function takes two arrays as input and returns a new array with the maximum value at each element-wise index.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.maximum.html
numpy.maximum — NumPy v2.1 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 ...
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>
🌐
JAX Documentation
docs.jax.dev › en › latest › _autosummary › jax.numpy.maximum.html
jax.numpy.maximum - JAX documentation - Read the Docs
>>> nan = jnp.nan >>> x2 = jnp.array([nan, -3, 9]) >>> y2 = jnp.array([[4, -2, nan], ... [-3, -5, 10]]) >>> jnp.maximum(x2, y2) Array([[nan, -2., nan], [nan, -3., 10.]], dtype=float32)
🌐
TutorialsPoint
tutorialspoint.com › compare-two-arrays-and-return-the-element-wise-maximum-in-numpy
Compare two arrays and return the element-wise maximum in Numpy
November 28, 2018 - To compare two arrays and return the element-wise maximum, use the numpy.maximum() method in Python Numpy. Return value is either True or False. Returns the maximum of x1 and x2, element-wise. This is a scalar if both x1 and x2 ar
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › how to calculate maximum of array in numpy
How to Calculate Maximum of Array in NumPy - Spark By {Examples}
September 24, 2024 - In this program, np.maximum() compares the two scalar values arr and arr1 and returns an array-like object containing the maximum value, which is 24 in this case · # Import numpy import numpy as np # Initialize variables arr = 15 arr1 = 24 # Get maximum value of two scalars max_value = np.maximum(arr, arr1) print ("After getting the maximum value is:", max_value)
🌐
Medium
medium.com › @amit25173 › understanding-element-wise-maximum-in-numpy-43916b1c2002
Understanding Element-wise Maximum in NumPy | by Amit Yadav | Medium
March 6, 2025 - When working with arrays, there are many times when you need to compare elements one by one and pick the maximum value at each position. That’s where NumPy’s maximum() function comes into play. It efficiently finds the element-wise max between ...
🌐
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 › doc › stable › reference › generated › numpy.max.html
numpy.max — NumPy v2.4 Manual
The maximum value of an array along a given axis, ignoring any NaNs. ... Element-wise maximum of two arrays, propagating any NaNs.
🌐
Sharp Sight
sharpsight.ai › blog › numpy-maximum
How to Use the Numpy Maximum Function - Sharp Sight
February 13, 2021 - So np.max typically takes a single Numpy array as an input, and will return the maximum value (although there are ways to use it where it will return maxima of the rows or columns). In contrast, Numpy maximum (which we’re discussing in this tutorial) computes the element-wise maximum of two arrays.