相关疑难解决方法(0)

熊猫:删除重复索引的所有记录

我有一个数据集,可能有重复的标识符记录appkey.理想情况下,重复的记录应该不存在,因此我将它们视为数据收集错误.我需要删除appkey多次出现的所有实例.

drop_duplicates方法在这种情况下是无效的(或者是?),因为它选择了第一个或最后一个重复项.是否有任何明显的成语用熊猫实现这一目标?

duplicates pandas

11
推荐指数
2
解决办法
2092
查看次数

使用Python中的Pandas,为每个组选择最高值行

使用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)

(抱歉,我是一只大熊猫.)

python pandas

1
推荐指数
1
解决办法
2529
查看次数

标签 统计

pandas ×2

duplicates ×1

python ×1