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
3 months agoBulah
2 months agoKirby
2 months agoFannie
2 months agoDolores
3 months agoVincent
4 months agoSolange
4 months agoBambi
3 months agoDenna
3 months agoMy
4 months agoGlory
4 months agoAudry
3 months agoDulce
3 months agoCandra
4 months agoSylvie
4 months agoPilar
3 months agoEdgar
3 months agoAmalia
3 months agoBarbra
4 months agoIvette
4 months agoLynelle
4 months agoKimberely
3 months agoDominic
4 months agoDominga
4 months agoHuey
4 months ago