Arrays | NumPy | Python Methods and Functions

Using the

method, we can get the common fill values from both masked arrays, if they are the same, using **np.ma.common_fill_value()** ` np.ma .common_fill_value () `

.

Syntax:`np.ma.common_fill_value (array1, array2)`

Return:Return the common filling value from both the arrays.

** Example # 1: **

In this example, using ` np.ma.common_fill_value () `

we can get common fill values from both masked arrays.

` ` |

** Output: **

1

** Example # 2: **

` `

` ` ` # NumPy import `

` import `

` numpy as np `

` x `

` = `

` np.ma.array ([[`

` 1 `

`, `

` 2 `

`], [`

` 2 `

`, `

` 1 `

`]], fill_value `

` = `

` 2 `

`) `

` y `

` = `

` np.ma.array ([[`

` 1 ``, `

` 5 `

`], [`

` 5 `

`, `

` 1 `

`] ], fill_value `

` = `

` 5 `

`) `

` # using the np.ma.common_fill_value () method `

` gfg `

` = `

` np.ma.common_fill_value (x, y) `

` print `

` (gfg) `

` `

** Output: **

None

In Learn Python 3 the Hard Way PDF, you'll learn Python by working through 52 brilliantly crafted exercises. Read them. Enter your code exactly. (No copying and pasting!) Correct your mistakes. ...

05/09/2021

90 SPECIFIC WAYS TO WRITE BETTER PYTHON. The Python programming language has unique strengths and charms that can be hard to grasp. Many programmers familiar with other languages often approach Pyt...

23/09/2020

The big data era is upon us: data are being generated, analyzed, and used at an unprecedented scale, and data-driven decision making is sweeping through all aspects of society. Since the value of data...

10/07/2020

In the last decade, we have seen the impact of exponential advances in technology on the way we work, shop, communicate, and think. At the heart of this change is our ability to collect and gain insig...

10/07/2020

X
# Submit new EBook