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)
| 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], |