pandas.Index.has_duplicates#
- property Index.has_duplicates[source]#
Check if the Index has duplicate values.
- Returns
- bool
Whether or not the Index has duplicate values.
Examples
>>> idx = pd.Index([1, 5, 7, 7]) >>> idx.has_duplicates True
>>> idx = pd.Index([1, 5, 7]) >>> idx.has_duplicates False
>>> idx = pd.Index(["Watermelon", "Orange", "Apple", ... "Watermelon"]).astype("category") >>> idx.has_duplicates True
>>> idx = pd.Index(["Orange", "Apple", ... "Watermelon"]).astype("category") >>> idx.has_duplicates False