Arrays | NumPy | Python Methods and Functions

** **

` `

is a subclass of ndarray for manipulating numeric arrays with missing data. With Numpy ** numpy.ma.MaskedArray class ** * MaskedArray .__ mod__ *, each element in the masked array works with a binary operator, i.e. mod (%). Remember we can use any type of value in the array, and the value for mod is applied as a parameter in MaskedArray .__ mod __ ().

Syntax:numpy. MaskedArray .__ mod__

Return:Return self% value.

** Example # 1: **

We can see that the value we passed through the MaskedArray .__ mod __ () method is used to perform a mod operation on each element of the array.

` ` |

** Output: **

[1.0 0.5 1.0 0.7999999999999998 1.0]

** Example # 2: **

` `

` ` ` # import an important module into python `

` import `

` numpy as np `

` # make an array with NumPy `

` gfg `

` = `

` np.ma .array ([[`

` 1 `

`, `

` 2 `

`, `

` 3 `

`, `

` 4.45 `

`, `

` 5 `

`], `

` [`

` 6 `

`, `

` 5.5 `

`, `

` 4 `

`, `` 3 `

`, `

` 2.62 `

`]] ) `

` `

` # applying the MaskedArray method .__ mod __ () `

` ` ` print `

` (gfg .__ mod __ (`

` 3 `

`)) `

` `

** Exit:**

[[1.0 2.0 0.0 1.4500000000000002 2.0] [0.0 2.5 1.0 0.0 2.62]]

Taking into account the development of modern programming, especially the emerging programming languages that reflect modern practice, Numerical Programming: A Practical Guide for Scientists and...

08/08/2021

The Apache Hadoop software library has come into it’s own. It is the basis for advanced distributed development for a host of companies, government institutions, and scientific research facilities. ...

10/07/2020

Deep Learning for Coders with fastai and PyTorch: AI Applications Without a PhD. Deep learning is often seen as the exclusive domain of math PhDs and big tech companies. But as this how-to guide sh...

05/09/2021

It’s in all of us. Data science is what makes us humans what we are today. No, not the computer-driven da...

10/07/2020

X
# Submit new EBook