Thursday, November 20, 2025
HomeLanguagesPython | numpy.ma.ids() method

Python | numpy.ma.ids() method

With the help of numpy.ma.ids() method, we can get the address of masked array having data by using numpy.ma.ids() method.

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

Example #1 :
In this example we can see that by using numpy.ma.ids() method, we are able to get the address of the targeted masked array.




# import numpy.ma
import numpy.ma as ma
  
# using numpy.ma.ids() method
gfg = ma.array([1, 2, 4, 8], mask =[1, 0, 0, 1])
  
print(gfg.ids())


Output :

(2172543392448, 2172542026240)

Example #2 :




# import numpy.ma
import numpy.ma as ma
  
# using numpy.ma.ids() method
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)

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32405 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6779 POSTS0 COMMENTS
Nicole Veronica
11927 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11995 POSTS0 COMMENTS
Shaida Kate Naidoo
6906 POSTS0 COMMENTS
Ted Musemwa
7163 POSTS0 COMMENTS
Thapelo Manthata
6862 POSTS0 COMMENTS
Umr Jansen
6846 POSTS0 COMMENTS