dask 2021.10.0

NotesParametersReturnsBackRef
max(a, axis=None, keepdims=False, split_every=None, out=None)

This docstring was copied from numpy.max.

Some inconsistencies with the Dask version may exist.

Notes

NaN values are propagated, that is if at least one item is NaN, the corresponding max value will be NaN as well. To ignore NaN values (MATLAB behavior), please use nanmax.

Don't use :None:None:`amax` for element-wise comparison of 2 arrays; when a.shape[0] is 2, maximum(a[0], a[1]) is faster than amax(a, axis=0) .

Parameters

a : array_like

Input data.

axis : None or int or tuple of ints, optional

Axis or axes along which to operate. By default, flattened input is used.

versionadded

If this is a tuple of ints, the maximum is selected over multiple axes, instead of a single axis or all the axes as before.

out : ndarray, optional

Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output. See ufuncs-output-type for more details.

keepdims : bool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.

If the default value is passed, then keepdims will not be passed through to the :None:None:`amax` method of sub-classes of :None:None:`ndarray`, however any non-default value will be. If the sub-class' method does not implement keepdims any exceptions will be raised.

initial : scalar, optional (Not supported in Dask)

The minimum value of an output element. Must be present to allow computation on empty slice. See :None:None:`~numpy.ufunc.reduce` for details.

versionadded
where : array_like of bool, optional (Not supported in Dask)

Elements to compare for the maximum. See :None:None:`~numpy.ufunc.reduce` for details.

versionadded

Returns

amax : ndarray or scalar

Maximum of a. If :None:None:`axis` is None, the result is a scalar value. If :None:None:`axis` is given, the result is an array of dimension a.ndim - 1 .

Return the maximum of an array or maximum along an axis.

See Also

amin

The minimum value of an array along a given axis, propagating any NaNs.

argmax

Return the indices of the maximum values.

fmax

Element-wise maximum of two arrays, ignoring any NaNs.

fmin
maximum

Element-wise maximum of two arrays, propagating any NaNs.

minimum
nanmax

The maximum value of an array along a given axis, ignoring any NaNs.

nanmin

Examples

This example is valid syntax, but we were not able to check execution
>>> a = np.arange(4).reshape((2,2))  # doctest: +SKIP
... a # doctest: +SKIP array([[0, 1], [2, 3]])
This example is valid syntax, but we were not able to check execution
>>> np.amax(a)           # Maximum of the flattened array  # doctest: +SKIP
3
This example is valid syntax, but we were not able to check execution
>>> np.amax(a, axis=0)   # Maxima along the first axis  # doctest: +SKIP
array([2, 3])
This example is valid syntax, but we were not able to check execution
>>> np.amax(a, axis=1)   # Maxima along the second axis  # doctest: +SKIP
array([1, 3])
This example is valid syntax, but we were not able to check execution
>>> np.amax(a, where=[False, True], initial=-1, axis=0)  # doctest: +SKIP
array([-1,  3])
This example is valid syntax, but we were not able to check execution
>>> b = np.arange(5, dtype=float)  # doctest: +SKIP
... b[2] = np.NaN # doctest: +SKIP
... np.amax(b) # doctest: +SKIP nan
This example is valid syntax, but we were not able to check execution
>>> np.amax(b, where=~np.isnan(b), initial=-1)  # doctest: +SKIP
4.0
This example is valid syntax, but we were not able to check execution
>>> np.nanmax(b)  # doctest: +SKIP
4.0

You can use an initial value to compute the maximum of an empty slice, or to initialize it to a different value:

This example is valid syntax, but we were not able to check execution
>>> np.amax([[-50], [10]], axis=-1, initial=0)  # doctest: +SKIP
array([ 0, 10])

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.

This example is valid syntax, but we were not able to check execution
>>> np.amax([5], initial=6)  # doctest: +SKIP
6
This example is valid syntax, but we were not able to check execution
>>> max([5], default=6)  # doctest: +SKIP
5
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.reductions.nanmax dask.array.reductions.max

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/reductions.py#385
type: <class 'function'>
Commit: