Python | numpy.ma.ids () method

NumPy | Python Methods and Functions

Using the numpy.ma.ids() method, we can get the address of the masked array containing the data using numpy.ma.ids () .

Syntax: numpy.ma.ids (array, mask)
Return: Return the address of masked array.

Example # 1:
In this example, we can see that with numpy. ma.ids () we can get the address of the target masked array.

Output:

(2172543392448, 2172542026240)

Example # 2:

# import numpy.ma

import numpy.ma as ma

  
# using the numpy.ma.ids () method

gfg = ma.array ([ 1 , 2 , 4 , 8 ], mask = [ 1 , 0 , 0 , 1 ])

 

print (gfg.ids ())

# import numpy.ma

import numpy.ma as ma

 
# using the method numpy.ma.ids ()

gfg = ma.array ([[ 1 , 2 , 3 ], [ 4 , 5 , 6 ], [ 7 , 8 , 9 ]], 

mask = [[ 1 , 0 , 0 ], [ 0 , 1 , 0 ], [ 0 , 0 , 1 ]])

 

print (gfg .ids ())

print (gfg)

Output:

(2172299359856, 2172543392224)

masked_array (
data = [[-, 2, 3],
[4, -, 6],
[7, 8, -]] ,
mask = [[True, False, False],
[False, True, False],
[False, False, True]],
fill_value = 999999)





Get Solution for free from DataCamp guru