def reindex(series1, series2):

    # turns out the merge is much faster than the .loc below
    df = pd.merge(series2.to_frame(name='left'),
                  series1.to_frame(name='right'),
                  left_on="left",
                  right_index=True,
                  how="left")
    return df.right

    # return pd.Series(series1.loc[series2.values].values, index=series2.index)
This reindexes the first series by the second series.  This is an extremely
dataset/ETHPy150Open UDST/activitysim/activitysim/util/reindex.py/reindex