python-3.x - 如果两列相等,如何删除重复项
问题描述
数据框是
View player country
Admin_Case_View ckear USA
Admin_Case_View ckear
Admin_Case_View ckear
Admin_Questions jungeunk KOR
Admin_Questions jungeunk
如果view == player
,则删除重复项,并且国家列中的位置为空。
所需的输出应该是
View player country
Admin_Case_View ckear USA
Admin_Questions jungeunk KOR
解决方案
就像是
df.dropna(subset=['country']).drop_duplicates(subset=['View', 'player'])
如果我理解正确,应该可以解决问题。
推荐阅读
- java - 理解 java Stream.limit() 操作
- javascript - Angular 7 中的访问函数
- angular - Ngx Datatable 显示一行条目
- c# - 验证 SSL 证书
- hibernate - 如何在sql过程和hibernate中处理数据加密
- python - 如何在 Netbeans 8.2 中输入 Python
- pandas - 比较和替换列项目熊猫数据框
- android - 多次调用 Slot、stop 方法
- ruby-on-rails - Rails 5:为什么即使我删除了迁移文件,rails 也会向 schema.rb 添加列
- python - 从基于表的下拉列表中选择值:Selenium Python