Return the maximum of an array or maximum along an axis. 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. If this is a tuple of ints,
(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
where=np._NoValue)
| 3049 | @array_function_dispatch(_max_dispatcher) |
| 3050 | @set_module('numpy') |
| 3051 | def max(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue, |
| 3052 | where=np._NoValue): |
| 3053 | """ |
| 3054 | Return the maximum of an array or maximum along an axis. |
| 3055 | |
| 3056 | Parameters |
| 3057 | ---------- |
| 3058 | a : array_like |
| 3059 | Input data. |
| 3060 | axis : None or int or tuple of ints, optional |
| 3061 | Axis or axes along which to operate. By default, flattened input is |
| 3062 | used. If this is a tuple of ints, the maximum is selected over |
| 3063 | multiple axes, instead of a single axis or all the axes as before. |
| 3064 | |
| 3065 | out : ndarray, optional |
| 3066 | Alternative output array in which to place the result. Must |
| 3067 | be of the same shape and buffer length as the expected output. |
| 3068 | See :ref:`ufuncs-output-type` for more details. |
| 3069 | |
| 3070 | keepdims : bool, optional |
| 3071 | If this is set to True, the axes which are reduced are left |
| 3072 | in the result as dimensions with size one. With this option, |
| 3073 | the result will broadcast correctly against the input array. |
| 3074 | |
| 3075 | If the default value is passed, then `keepdims` will not be |
| 3076 | passed through to the ``max`` method of sub-classes of |
| 3077 | `ndarray`, however any non-default value will be. If the |
| 3078 | sub-class' method does not implement `keepdims` any |
| 3079 | exceptions will be raised. |
| 3080 | |
| 3081 | initial : scalar, optional |
| 3082 | The minimum value of an output element. Must be present to allow |
| 3083 | computation on empty slice. See `~numpy.ufunc.reduce` for details. |
| 3084 | |
| 3085 | where : array_like of bool, optional |
| 3086 | Elements to compare for the maximum. See `~numpy.ufunc.reduce` |
| 3087 | for details. |
| 3088 | |
| 3089 | Returns |
| 3090 | ------- |
| 3091 | max : ndarray or scalar |
| 3092 | Maximum of `a`. If `axis` is None, the result is a scalar value. |
| 3093 | If `axis` is an int, the result is an array of dimension |
| 3094 | ``a.ndim - 1``. If `axis` is a tuple, the result is an array of |
| 3095 | dimension ``a.ndim - len(axis)``. |
| 3096 | |
| 3097 | See Also |
| 3098 | -------- |
| 3099 | min : |
| 3100 | The minimum value of an array along a given axis, propagating any NaNs. |
| 3101 | nanmax : |
| 3102 | The maximum value of an array along a given axis, ignoring any NaNs. |
| 3103 | maximum : |
| 3104 | Element-wise maximum of two arrays, propagating any NaNs. |
| 3105 | fmax : |
| 3106 | Element-wise maximum of two arrays, ignoring any NaNs. |
| 3107 | argmax : |
| 3108 | Return the indices of the maximum values. |