def row_ismember(a, b):
    """Tests whether rows of a occur in b.

    Parameters
    ----------
    a : numpy.array
        a 2D array with the same number of columns as b.
    b : numpy.array
        a 2D array with the same number of columns as a.

    Returns
    -------
    numpy.array
        Indices of rows in a that occur in b.
    """

    bind = {}
    for i, elt in enumerate(b):
        if tuple(elt) not in bind:
            bind[tuple(elt)] = i
    return [bind.get(tuple(itm), None) for itm in a]