summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorFelix Hirwa Nshuti <hirwanshutiflx@gmail.com>2022-10-01 11:25:24 +0000
committerFelix Hirwa Nshuti <hirwanshutiflx@gmail.com>2022-10-01 11:25:24 +0000
commit395129e886865c15c72da604ff8f3ee2c9a67060 (patch)
treee325e6b475e090c0b8705c71e0a1e3e0b35c7cc2 /numpy/ma/core.py
parentb654752c240936596d23b5bfb2e00d2bacbcf50f (diff)
downloadnumpy-395129e886865c15c72da604ff8f3ee2c9a67060.tar.gz
Added ma.min examples
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index d3cbb33e5..375d5c770 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -5769,6 +5769,36 @@ class MaskedArray(ndarray):
ma.minimum_fill_value
Returns the minimum filling value for a given datatype.
+ Examples
+ --------
+ >>> import numpy.ma as ma
+ >>> x = [[1., -2., 3.], [0.2, -0.7, 0.1]]
+ >>> mask = [[1, 1, 0], [0, 0, 1]]
+ >>> masked_x = ma.masked_array(x, mask)
+ >>> masked_x
+ masked_array(
+ data=[[--, --, 3.0],
+ [0.2, -0.7, --]],
+ mask=[[ True, True, False],
+ [False, False, True]],
+ fill_value=1e+20)
+ >>> ma.min(masked_x)
+ -0.7
+ >>> ma.min(masked_x, axis=-1)
+ masked_array(data=[3.0, -0.7],
+ mask=[False, False],
+ fill_value=1e+20)
+ >>> ma.min(masked_x, axis=0, keepdims=True)
+ masked_array(data=[[0.2, -0.7, 3.0]],
+ mask=[[False, False, False]],
+ fill_value=1e+20)
+ >>> mask = [[1, 1, 1,], [1, 1, 1]]
+ >>> masked_x = ma.masked_array(x, mask)
+ >>> ma.min(masked_x, axis=0)
+ masked_array(data=[--, --, --],
+ mask=[ True, True, True],
+ fill_value=1e+20,
+ dtype=float64)
"""
kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims}