summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSomasree Majumder <bishnupadamajumder32@gmail.com>2023-04-10 23:58:54 +0530
committerGitHub <noreply@github.com>2023-04-10 11:28:54 -0700
commite29a9a3453d2d944bcba9787c4c5d87223976fc8 (patch)
tree233e23c4f9ab1d6337b7cc1055e9edc5d502d03f
parent7715f50ab5b122d8b516caca387a176c2793a749 (diff)
downloadnumpy-e29a9a3453d2d944bcba9787c4c5d87223976fc8.tar.gz
DOC: Add docstring examples for np.ma.right_shift (#23393)
Co-authored-by: Charles Harris <charlesr.harris@gmail.com> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
-rw-r--r--numpy/ma/core.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 7f57985a9..132761711 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -7202,6 +7202,21 @@ def right_shift(a, n):
--------
numpy.right_shift
+ Examples
+ --------
+ >>> import numpy.ma as ma
+ >>> x = [11, 3, 8, 1]
+ >>> mask = [0, 0, 0, 1]
+ >>> masked_x = ma.masked_array(x, mask)
+ >>> masked_x
+ masked_array(data=[11, 3, 8, --],
+ mask=[False, False, False, True],
+ fill_value=999999)
+ >>> ma.right_shift(masked_x,1)
+ masked_array(data=[5, 1, 4, --],
+ mask=[False, False, False, True],
+ fill_value=999999)
+
"""
m = getmask(a)
if m is nomask: