import warnings


def deduplicate(S):
    """deduplicate pd.Series by removing rows with same index and values"""
    dedup = S.groupby(S.index).first()
    diff = len(S) - len(dedup)
    if diff:
        warnings.warn(f"found {diff} duplicates in S, removing them")
        return dedup
    return S