您需要 登录 才可以下载或查看,没有账号?立即注册
import pandas as pd col = ["apple", "pearl", "watermelon"] * 4 pri = [2.50, 3.00, 2.75] * 4 df = pd.DataFrame({"fruit": col, "price" : pri}) print (df) print ('查看重复数据:',df.duplicated()) df1 = df.drop_duplicates() print (df1)
df2 = df.drop_duplicates(keep="last") print (df2)
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)
GMT+8, 2025-1-17 00:48
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.