def data2proddummy(x):
 groups = np.unique(lmap(tuple, x.tolist()))
 return (x == groups[:, None, :]).all((-1)).T.astype(int)[:, :(-1)]

def data2proddummy ( x ) : groups = np . unique ( lmap ( tuple , x . tolist ( ) ) ) return ( x == groups [ : , None , : ] ) . all ( ( - 1 ) ) . T . astype ( int ) [ : , : ( - 1 ) ]
creates product dummy variables from 2 columns of 2d array drops last dummy variable .