MCPcopy
hub / github.com/numpy/numpy / max

Method max

numpy/ma/core.py:5973–6077  ·  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. If this is a tuple of ints, the

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

Source from the content-addressed store, hash-verified

5971 return out
5972
5973 def max(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue):
5974 """
5975 Return the maximum along a given axis.
5976
5977 Parameters
5978 ----------
5979 axis : None or int or tuple of ints, optional
5980 Axis along which to operate. By default, ``axis`` is None and the
5981 flattened input is used.
5982 If this is a tuple of ints, the maximum is selected over multiple
5983 axes, instead of a single axis or all the axes as before.
5984 out : array_like, optional
5985 Alternative output array in which to place the result. Must
5986 be of the same shape and buffer length as the expected output.
5987 fill_value : scalar or None, optional
5988 Value used to fill in the masked values.
5989 If None, use the output of maximum_fill_value().
5990 keepdims : bool, optional
5991 If this is set to True, the axes which are reduced are left
5992 in the result as dimensions with size one. With this option,
5993 the result will broadcast correctly against the array.
5994
5995 Returns
5996 -------
5997 amax : array_like
5998 New array holding the result.
5999 If ``out`` was specified, ``out`` is returned.
6000
6001 See Also
6002 --------
6003 ma.maximum_fill_value
6004 Returns the maximum filling value for a given datatype.
6005
6006 Examples
6007 --------
6008 >>> import numpy.ma as ma
6009 >>> x = [[-1., 2.5], [4., -2.], [3., 0.]]
6010 >>> mask = [[0, 0], [1, 0], [1, 0]]
6011 >>> masked_x = ma.masked_array(x, mask)
6012 >>> masked_x
6013 masked_array(
6014 data=[[-1.0, 2.5],
6015 [--, -2.0],
6016 [--, 0.0]],
6017 mask=[[False, False],
6018 [ True, False],
6019 [ True, False]],
6020 fill_value=1e+20)
6021 >>> ma.max(masked_x)
6022 2.5
6023 >>> ma.max(masked_x, axis=0)
6024 masked_array(data=[-1.0, 2.5],
6025 mask=[False, False],
6026 fill_value=1e+20)
6027 >>> ma.max(masked_x, axis=1, keepdims=True)
6028 masked_array(
6029 data=[[2.5],
6030 [-2.0],

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
_ptpFunction · 0.45
_get_outer_edgesFunction · 0.45
_arg_trim_zerosFunction · 0.45
_quantile_is_validFunction · 0.45
_isinFunction · 0.45
test_randomMethod · 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 15

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_minmax_intsMethod · 0.36