def unique_index(df):
    try:
        assert df.index.is_unique
    except AssertionError as e:
        e.args = df.index.get_duplicates()
        raise
    return df
Assert that the index is unique
dataset/ETHPy150Open TomAugspurger/engarde/engarde/checks.py/unique_index