pandas-定位消除重复数据
程序员文章站
2022-06-02 12:52:05
...
import pandas as pd
student = pd.read_excel('C:/Users/zuxia/Downloads/020/Students_Duplicates.xlsx')
#去掉数据中的重复数据
# student.drop_duplicates(subset='Name',inplace=True,keep='last')
# print(student)
#找出重复数据
dupe = student.duplicated(subset='Name')
dupe = dupe[dupe]
print(student.iloc[dupe.index])
上一篇: 喝水能减肥吗 专家提醒减肥一定要多喝水