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. 
 
 - See also - Index.is_unique
- Inverse method that checks if it has unique 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