Index.
putmask
Return a new Index of the values set with the mask.
See also
numpy.ndarray.putmask
pandas.Index.nunique
pandas.Index.ravel