numpy.ma.right_shift — NumPy v2.6.dev0 Manual

ma.right_shift(a, n)

[source]

#

Shift the bits of an integer to the right.

This is the masked array version of

numpy.right_shift

, for details see that function.

Examples

>>> importnumpyasnp>>> importnumpy.maasma>>> x=[11,3,8,1]>>> mask=[0,0,0,1]>>> masked_x=ma.masked_array(x,mask)>>> masked_xmasked_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)