To find the duplicate rows, you can use df.duplicated() and to remove the duplicate rows, you can use df.drop_duplicates(). Check the following example:
>>> import pandas as pd>>> df = pd.DataFrame({'a':[1,2,3,4,1,2,5],'b':[11,12,13,14,11,12,15]})>>> df a b0 1 111 2 122 3 133 4 144 1 115 2 126 5 15To find the duplicate rows:>>> df[df.duplicated()] a b4 1 115 2 12To delete the duplicate rows:>>> df.drop_duplicates() a b0 1 111 2 122 3 133 4 146 5 15
>>> import pandas as pd>>> df = pd.DataFrame({'a':[1,2,3,4,1,2,5],'b':[11,12,13,14,11,12,15]})>>> df a b0 1 111 2 122 3 133 4 144 1 115 2 126 5 15
To find the duplicate rows:
>>> df[df.duplicated()] a b4 1 115 2 12To delete the duplicate rows:>>> df.drop_duplicates() a b0 1 111 2 122 3 133 4 146 5 15