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. .. versionadded::
(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
where=np._NoValue)
| 2692 | @array_function_dispatch(_max_dispatcher) |
| 2693 | @set_module('numpy') |
| 2694 | def max(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue, |
| 2695 | where=np._NoValue): |
| 2696 | """ |
| 2697 | Return the maximum of an array or maximum along an axis. |
| 2698 | |
| 2699 | Parameters |
| 2700 | ---------- |
| 2701 | a : array_like |
| 2702 | Input data. |
| 2703 | axis : None or int or tuple of ints, optional |
| 2704 | Axis or axes along which to operate. By default, flattened input is |
| 2705 | used. |
| 2706 | |
| 2707 | .. versionadded:: 1.7.0 |
| 2708 | |
| 2709 | If this is a tuple of ints, the maximum is selected over multiple axes, |
| 2710 | instead of a single axis or all the axes as before. |
| 2711 | out : ndarray, optional |
| 2712 | Alternative output array in which to place the result. Must |
| 2713 | be of the same shape and buffer length as the expected output. |
| 2714 | See :ref:`ufuncs-output-type` for more details. |
| 2715 | |
| 2716 | keepdims : bool, optional |
| 2717 | If this is set to True, the axes which are reduced are left |
| 2718 | in the result as dimensions with size one. With this option, |
| 2719 | the result will broadcast correctly against the input array. |
| 2720 | |
| 2721 | If the default value is passed, then `keepdims` will not be |
| 2722 | passed through to the ``max`` method of sub-classes of |
| 2723 | `ndarray`, however any non-default value will be. If the |
| 2724 | sub-class' method does not implement `keepdims` any |
| 2725 | exceptions will be raised. |
| 2726 | |
| 2727 | initial : scalar, optional |
| 2728 | The minimum value of an output element. Must be present to allow |
| 2729 | computation on empty slice. See `~numpy.ufunc.reduce` for details. |
| 2730 | |
| 2731 | .. versionadded:: 1.15.0 |
| 2732 | |
| 2733 | where : array_like of bool, optional |
| 2734 | Elements to compare for the maximum. See `~numpy.ufunc.reduce` |
| 2735 | for details. |
| 2736 | |
| 2737 | .. versionadded:: 1.17.0 |
| 2738 | |
| 2739 | Returns |
| 2740 | ------- |
| 2741 | max : ndarray or scalar |
| 2742 | Maximum of `a`. If `axis` is None, the result is a scalar value. |
| 2743 | If `axis` is an int, the result is an array of dimension |
| 2744 | ``a.ndim - 1``. If `axis` is a tuple, the result is an array of |
| 2745 | dimension ``a.ndim - len(axis)``. |
| 2746 | |
| 2747 | See Also |
| 2748 | -------- |
| 2749 | amin : |
| 2750 | The minimum value of an array along a given axis, propagating any NaNs. |
| 2751 | nanmax : |