def fast_isin(X, Y):
 if (len(Y) > 0):
  T = Y.copy()
  T.sort()
  D = T.searchsorted(X)
  T = np.append(T, np.array([0]))
  W = (T[D] == X)
  if isinstance(W, bool):
   return np.zeros((len(X),), bool)
  else:
   return (T[D] == X)
 else:
  return np.zeros((len(X),), bool)

def fast_isin ( X , Y ) : if ( len ( Y ) > 0 ) : T = Y . copy ( ) T . sort ( ) D = T . searchsorted ( X ) T = np . append ( T , np . array ( [ 0 ] ) ) W = ( T [ D ] == X ) if isinstance ( W , bool ) : return np . zeros ( ( len ( X ) , ) , bool ) else : return ( T [ D ] == X ) else : return np . zeros ( ( len ( X ) , ) , bool )
indices of elements in a numpy array that appear in another .