numpy.MaskedArray.masked_equal() is used to mask an array equal to a given value.
numpy.ma.masked_equal (arr, value, copy = True)
arr: strong> [ndarray] Input array which we want to mask.
value: [int] Element of masked array which we want to mask.
copy: strong> [bool] If True (default) make a copy of arr in the result. If False modify arr in place and return a view.
Return: [MaskedArray] The result of masking.
Code # 1:
Input array: [1 2 3 -1 2] Masked array: [1 - 3 -1 -]
Code # 2:
Input array: [2.0e + 08 3.0e-05 -4.5e + 01 2.0e + 05 5.0e + 02] Masked array: [200000000.0 3e-05 -45.0 200000.0 -]
Efficiently perform data collection, wrangling, analysis, and visualization using Python. Recent advancements in computing and artificial intelligence have completely changed the way we understand ...
Python Crash Course is the world's best-selling guide to the Python programming language. This quick and in-depth introduction to Python programming will get you started writing programs, solving prob...
Mark Lutz is the global leader in Python training, author of the oldest and best-selling Python texts, and a pioneer in the Python community since 1992.
Mark Lutz is the author of the found...
It’s in all of us. Data science is what makes us humans what we are today. No, not the computer-driven da...