numpy.ma.MaskedArray.toflex() function – Python
numpy.ma.MaskedArray.toflex() function transforms a masked array into a flexible-type array. The flexible type array that is returned will have two fields: the _data field and the _mask field. The _data field stores the _data part of the array and the _mask field stores the _mask part of the array.
Syntax : numpy.ma.MaskedArray.toflex(self)
Return : [ndarray] A new flexible-type ndarray with two fields: the first element containing a value, the second element containing the corresponding mask boolean. The returned record shape matches self.shape.
Code #1 :
[[(1, False) (2, True) (3, False)] [(4, True) (5, False) (6, True)] [(7, False) (8, True) (9, False)]]
Code #2 :
[[(11, False) (12, True) (13, True)] [(14, True) (15, True) (16, True)] [(17, True) (18, True) (19, True)]]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course