This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 6: DataFrame methods

Drop duplicates

face Josiah Wang

The df.drop_duplicates() method will return a new DataFrame with duplicates removed.

See the official documentation to see the options available.

Apparently, there are two duplicate rows in the Pokemon dataset! Use the .drop_duplicates() method to remove them!

>>> df = pd.read_csv("pokemon.csv", index_col="Name")
>>> print(df.shape)
(800, 12)
>>> df.drop_duplicates(inplace=True)
>>> print(df.shape)
(798, 12)