pandas.Index.has_duplicates
- property Index.has_duplicates
-
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
© 2008–2021, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.3.4/reference/api/pandas.Index.has_duplicates.html