Loading [MathJax]/extensions/tex2jax.js
numpy 1.24.3 Pypi GitHub Homepage
Other Docs

ParametersReturns
max(obj, axis=None, out=None, fill_value=None, keepdims=<no value>)

Parameters

axis : None or int or tuple of ints, optional

Axis along which to operate. By default, axis is None and the flattened input is used. .. versionadded:: 1.7.0 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 : array_like, optional

Alternative output array in which to place the result. Must be of the same shape and buffer length as the expected output.

fill_value : scalar or None, optional

Value used to fill in the masked values. If None, use the output of maximum_fill_value().

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 array.

Returns

amax : array_like

New array holding the result. If out was specified, out is returned.

Return the maximum along a given axis.

See Also

ma.maximum_fill_value

Returns the maximum filling value for a given datatype.

Examples

import numpy.ma as ma
x = [[-1., 2.5], [4., -2.], [3., 0.]]
mask = [[0, 0], [1, 0], [1, 0]]
masked_x = ma.masked_array(x, mask)
masked_x
ma.max(masked_x)
ma.max(masked_x, axis=0)
ma.max(masked_x, axis=1, keepdims=True)
mask = [[1, 1], [1, 1], [1, 1]]
masked_x = ma.masked_array(x, mask)
ma.max(masked_x, axis=1)
See :

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.

ma.maximum_fill_valuemaximum_fill_value

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


GitHub : /numpy/ma/core.py#6791
type: <class 'function'>
Commit: