Skip to content

Commit 86cd584

Browse files
authored
Merge pull request numpy#22363 from hirwa-nshuti/ma-min-example
DOC: Added examples to `maa.min` function
2 parents 737016f + 25ca88c commit 86cd584

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

numpy/ma/core.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5769,6 +5769,36 @@ def min(self, axis=None, out=None, fill_value=None, keepdims=np._NoValue):
57695769
ma.minimum_fill_value
57705770
Returns the minimum filling value for a given datatype.
57715771
5772+
Examples
5773+
--------
5774+
>>> import numpy.ma as ma
5775+
>>> x = [[1., -2., 3.], [0.2, -0.7, 0.1]]
5776+
>>> mask = [[1, 1, 0], [0, 0, 1]]
5777+
>>> masked_x = ma.masked_array(x, mask)
5778+
>>> masked_x
5779+
masked_array(
5780+
data=[[--, --, 3.0],
5781+
[0.2, -0.7, --]],
5782+
mask=[[ True, True, False],
5783+
[False, False, True]],
5784+
fill_value=1e+20)
5785+
>>> ma.min(masked_x)
5786+
-0.7
5787+
>>> ma.min(masked_x, axis=-1)
5788+
masked_array(data=[3.0, -0.7],
5789+
mask=[False, False],
5790+
fill_value=1e+20)
5791+
>>> ma.min(masked_x, axis=0, keepdims=True)
5792+
masked_array(data=[[0.2, -0.7, 3.0]],
5793+
mask=[[False, False, False]],
5794+
fill_value=1e+20)
5795+
>>> mask = [[1, 1, 1,], [1, 1, 1]]
5796+
>>> masked_x = ma.masked_array(x, mask)
5797+
>>> ma.min(masked_x, axis=0)
5798+
masked_array(data=[--, --, --],
5799+
mask=[ True, True, True],
5800+
fill_value=1e+20,
5801+
dtype=float64)
57725802
"""
57735803
kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims}
57745804

0 commit comments

Comments
 (0)