summaryrefslogtreecommitdiff
path: root/numpy/core/fromnumeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/fromnumeric.py')
-rw-r--r--numpy/core/fromnumeric.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py
index bf92d6539..5735b6124 100644
--- a/numpy/core/fromnumeric.py
+++ b/numpy/core/fromnumeric.py
@@ -1903,11 +1903,11 @@ def amax(a, axis=None, out=None, keepdims=False):
a : array_like
Input data.
axis : int, optional
- Axis along which to operate. By default flattened input is used.
+ Axis along which to operate. By default, flattened input is used.
out : ndarray, optional
- Alternate output array in which to place the result. Must be of
- the same shape and buffer length as the expected output. See
- `doc.ufuncs` (Section "Output arguments") for more details.
+ Alternative output array in which to place the result. Must
+ be of the same shape and buffer length as the expected output.
+ See `doc.ufuncs` (Section "Output arguments") for more details.
keepdims : bool, optional
If this is set to True, the axes which are reduced are left
in the result as dimensions with size one. With this option,
@@ -1938,7 +1938,7 @@ def amax(a, axis=None, out=None, keepdims=False):
Notes
-----
NaN values are propagated, that is if at least one item is NaN, the
- corresponding max value will be NaN as well. To ignore NaN values
+ corresponding max value will be NaN as well. To ignore NaN values
(MATLAB behavior), please use nanmax.
Don't use `amax` for element-wise comparison of 2 arrays; when
@@ -1951,11 +1951,11 @@ def amax(a, axis=None, out=None, keepdims=False):
>>> a
array([[0, 1],
[2, 3]])
- >>> np.amax(a)
+ >>> np.amax(a) # Maximum of the flattened array
3
- >>> np.amax(a, axis=0)
+ >>> np.amax(a, axis=0) # Maxima along the first axis
array([2, 3])
- >>> np.amax(a, axis=1)
+ >>> np.amax(a, axis=1) # Maxima along the second axis
array([1, 3])
>>> b = np.arange(5, dtype=np.float)
@@ -1972,7 +1972,7 @@ def amax(a, axis=None, out=None, keepdims=False):
except AttributeError:
return _methods._amax(a, axis=axis,
out=out, keepdims=keepdims)
- # NOTE: Dropping and keepdims parameter
+ # NOTE: Dropping the keepdims parameter
return amax(axis=axis, out=out)
else:
return _methods._amax(a, axis=axis,
@@ -1987,7 +1987,7 @@ def amin(a, axis=None, out=None, keepdims=False):
a : array_like
Input data.
axis : int, optional
- Axis along which to operate. By default a flattened input is used.
+ Axis along which to operate. By default, flattened input is used.
out : ndarray, optional
Alternative output array in which to place the result. Must
be of the same shape and buffer length as the expected output.
@@ -1999,8 +1999,10 @@ def amin(a, axis=None, out=None, keepdims=False):
Returns
-------
- amin : ndarray
- A new array or a scalar array with the result.
+ amin : ndarray or scalar
+ Minimum of `a`. If `axis` is None, the result is a scalar value.
+ If `axis` is given, the result is an array of dimension
+ ``a.ndim - 1``.
See Also
--------
@@ -2019,9 +2021,9 @@ def amin(a, axis=None, out=None, keepdims=False):
Notes
-----
- NaN values are propagated, that is if at least one item is nan, the
- corresponding min value will be nan as well. To ignore NaN values (matlab
- behavior), please use nanmin.
+ NaN values are propagated, that is if at least one item is NaN, the
+ corresponding min value will be NaN as well. To ignore NaN values
+ (MATLAB behavior), please use nanmin.
Don't use `amin` for element-wise comparison of 2 arrays; when
``a.shape[0]`` is 2, ``minimum(a[0], a[1])`` is faster than
@@ -2035,9 +2037,9 @@ def amin(a, axis=None, out=None, keepdims=False):
[2, 3]])
>>> np.amin(a) # Minimum of the flattened array
0
- >>> np.amin(a, axis=0) # Minima along the first axis
+ >>> np.amin(a, axis=0) # Minima along the first axis
array([0, 1])
- >>> np.amin(a, axis=1) # Minima along the second axis
+ >>> np.amin(a, axis=1) # Minima along the second axis
array([0, 2])
>>> b = np.arange(5, dtype=np.float)