我有一个数据集,可能有重复的标识符记录appkey.理想情况下,重复的记录应该不存在,因此我将它们视为数据收集错误.我需要删除appkey多次出现的所有实例.
该drop_duplicates方法在这种情况下是无效的(或者是?),因为它选择了第一个或最后一个重复项.是否有任何明显的成语用熊猫实现这一目标?
使用Pandas,用于以下数据集
author1,category1,10.00
author1,category2,15.00
author1,category3,12.00
author2,category1,5.00
author2,category2,6.00
author2,category3,4.00
author2,category4,9.00
author3,category1,7.00
author3,category2,4.00
author3,category3,7.00
Run Code Online (Sandbox Code Playgroud)
我想为每位作者获得最高价值
author1,category2,15.00
author2,category4,9.00
author3,category1,7.00
author3,category3,7.00
Run Code Online (Sandbox Code Playgroud)
(抱歉,我是一只大熊猫.)