Which Python method can be used to Remove duplicates by Data scientist?
The drop_duplicates() method removes duplicate rows.
dataframe.drop_duplicates(subset, keep, inplace, ignore_index)
Remove duplicate rows from the DataFrame:
1. import pandas as pd
2. data = {
3. 'name': ['Peter', 'Mary', 'John', 'Mary'],
4. 'age': [50, 40, 30, 40],
5. 'qualified': [True, False, False, False]
6. }
7.
8. df = pd.DataFrame(data)
9. newdf = df.drop_duplicates()
Emelda
6 months agoBulah
5 months agoKirby
5 months agoFannie
5 months agoDolores
6 months agoVincent
6 months agoSolange
6 months agoBambi
6 months agoDenna
6 months agoMy
6 months agoGlory
7 months agoAudry
6 months agoDulce
6 months agoCandra
7 months agoSylvie
7 months agoPilar
6 months agoEdgar
6 months agoAmalia
6 months agoBarbra
7 months agoIvette
7 months agoLynelle
7 months agoKimberely
6 months agoDominic
7 months agoDominga
7 months agoHuey
7 months ago