MCPcopy Create free account
hub / github.com/numpy/numpy / max

Method max

numpy/ma/core.py:5859–5964  ·  view source on GitHub ↗

Return the maximum along a given axis. 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

(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue)

Source from the content-addressed store, hash-verified

5857 return out
5858
5859 def max(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue):
5860 """
5861 Return the maximum along a given axis.
5862
5863 Parameters
5864 ----------
5865 axis : None or int or tuple of ints, optional
5866 Axis along which to operate. By default, ``axis`` is None and the
5867 flattened input is used.
5868 .. versionadded:: 1.7.0
5869 If this is a tuple of ints, the maximum is selected over multiple
5870 axes, instead of a single axis or all the axes as before.
5871 out : array_like, optional
5872 Alternative output array in which to place the result. Must
5873 be of the same shape and buffer length as the expected output.
5874 fill_value : scalar or None, optional
5875 Value used to fill in the masked values.
5876 If None, use the output of maximum_fill_value().
5877 keepdims : bool, optional
5878 If this is set to True, the axes which are reduced are left
5879 in the result as dimensions with size one. With this option,
5880 the result will broadcast correctly against the array.
5881
5882 Returns
5883 -------
5884 amax : array_like
5885 New array holding the result.
5886 If ``out`` was specified, ``out`` is returned.
5887
5888 See Also
5889 --------
5890 ma.maximum_fill_value
5891 Returns the maximum filling value for a given datatype.
5892
5893 Examples
5894 --------
5895 >>> import numpy.ma as ma
5896 >>> x = [[-1., 2.5], [4., -2.], [3., 0.]]
5897 >>> mask = [[0, 0], [1, 0], [1, 0]]
5898 >>> masked_x = ma.masked_array(x, mask)
5899 >>> masked_x
5900 masked_array(
5901 data=[[-1.0, 2.5],
5902 [--, -2.0],
5903 [--, 0.0]],
5904 mask=[[False, False],
5905 [ True, False],
5906 [ True, False]],
5907 fill_value=1e+20)
5908 >>> ma.max(masked_x)
5909 2.5
5910 >>> ma.max(masked_x, axis=0)
5911 masked_array(data=[-1.0, 2.5],
5912 mask=[False, False],
5913 fill_value=1e+20)
5914 >>> ma.max(masked_x, axis=1, keepdims=True)
5915 masked_array(
5916 data=[[2.5],

Callers 15

ptpMethod · 0.95
test_in_bounds_fuzzMethod · 0.45
params_1Function · 0.45
test_in_bounds_fuzzMethod · 0.45
test_in_bounds_fuzzMethod · 0.45
in1dFunction · 0.45
_ptpFunction · 0.45
_get_outer_edgesFunction · 0.45
test_randomMethod · 0.45
matrix_rankFunction · 0.45

Calls 8

filledMethod · 0.95
_check_mask_axisFunction · 0.85
maximum_fill_valueFunction · 0.85
getmaskFunction · 0.85
make_mask_noneFunction · 0.85
MaskErrorClass · 0.85
__setmask__Method · 0.80
viewMethod · 0.45

Tested by 13

test_in_bounds_fuzzMethod · 0.36
params_1Function · 0.36
test_in_bounds_fuzzMethod · 0.36
test_in_bounds_fuzzMethod · 0.36
test_randomMethod · 0.36
doMethod · 0.36
test_minmaxMethod · 0.36
test_minmax_methodsMethod · 0.36
test_minmax_dtypesMethod · 0.36
test_minmaxMethod · 0.36