Python | Pandas Index.get_duplicates() Last Updated : 17 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.get_duplicates() function extract duplicated index elements. This function returns a sorted list of index elements which appear more than once in the Index. Syntax: Index.get_duplicates() Returns : List of duplicated indexes. Example #1: Use Index.get_duplicates() function to find all the duplicate values in the Index. Python3 # importing pandas as pd import pandas as pd # Creating the Index idx = pd.Index(['Labrador', 'Beagle', 'Labrador', 'Lhasa', 'Husky', 'Beagle']) # Print the Index idx Output : let's find out all the duplicate values in the Index. Python3 1== # print the duplicated values. idx.get_duplicates() Output : As we can see in the output, the Index.get_duplicates() function has returned all the values which are having more than one occurrence in the Index. Example #2: Use Index.get_duplicates() function to find all the duplicate in the Index. The Index also contains NaN values. Python3 # importing pandas as pd import pandas as pd # Creating the Index idx = pd.Index(['Labrador', 'Beagle', None, 'Labrador', 'Lhasa', 'Husky', 'Beagle', None, 'Koala']) # Print the Index idx Output : As we can see in the output we are having some missing values. Lets see how the Index.get_duplicates() function treats them. Python3 1== # print the duplicate values in Index idx.get_duplicates() Output : The occurrence of missing values more than once has been treated as duplicates. Comment More infoAdvertise with us Next Article Python | Pandas Index.get_duplicates() S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Python pandas-indexing Practice Tags : python Similar Reads Python | Pandas Index.duplicated() The Index.duplicated() method in Pandas is a powerful tool for identifying duplicate values within an index. It returns a boolean array where duplicates are marked as True based on the specified criteria and False denotes unique values or the first occurrence of duplicates. This method is especially 5 min read Python | Pandas Index.drop_duplicates() Pandas Index.drop_duplicates() function return Index with duplicate values removed in Python. Syntax of Pandas Index.drop_duplicates() Syntax: Index.drop_duplicates(labels, errors='raise')Â Parameters : keep : {âfirstâ, âlastâ, False} âfirstâ : Drop duplicates except for the first occurrence.(defaul 2 min read Python | Pandas Index.equals() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.equals() function determine if two Index objects contains the same elemen 2 min read Python | Pandas Index.identical() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.identical() function determine if two Index objects contains the same ele 2 min read Python | Pandas Index.asof() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.asof() function returns return the label from the index, or, if not prese 2 min read Like