久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Python Pandas 中刪除多列中的所有重復行

Drop all duplicate rows across multiple columns in Python Pandas(在 Python Pandas 中刪除多列中的所有重復行)
本文介紹了在 Python Pandas 中刪除多列中的所有重復行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

pandas drop_duplicates 函數非常適合唯一化"數據幀.但是,要傳遞的關鍵字參數之一是 take_last=Truetake_last=False,而我想刪除在列子集中重復的所有行.這可能嗎?

The pandas drop_duplicates function is great for "uniquifying" a dataframe. However, one of the keyword arguments to pass is take_last=True or take_last=False, while I would like to drop all rows which are duplicates across a subset of columns. Is this possible?

    A   B   C
0   foo 0   A
1   foo 1   A
2   foo 1   B
3   bar 1   A

例如,我想刪除與列 AC 匹配的行,所以這應該刪除第 0 行和第 1 行.

As an example, I would like to drop rows which match on columns A and C so this should drop rows 0 and 1.

推薦答案

現在有了 drop_duplicates 和 keep 參數.

This is much easier in pandas now with drop_duplicates and the keep parameter.

import pandas as pd
df = pd.DataFrame({"A":["foo", "foo", "foo", "bar"], "B":[0,1,1,1], "C":["A","A","B","A"]})
df.drop_duplicates(subset=['A', 'C'], keep=False)

這篇關于在 Python Pandas 中刪除多列中的所有重復行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 日韩精品免费在线观看 | 国内精品一区二区 | 日韩成人在线播放 | 韩日一区二区三区 | 欧美亚洲激情 | 婷婷毛片| 91麻豆精品国产91久久久久久久久 | 中文字幕第一页在线 | 欧美一区二区三区大片 | 精精国产xxxx视频在线播放 | 日本三级网址 | 91精品无人区卡一卡二卡三 | 欧美日韩专区 | 欧美成年人视频在线观看 | 日韩电影免费观看中文字幕 | 夜夜撸av| 黄色永久免费 | 亚洲精品乱码久久久久久蜜桃 | 青青草网 | 久久999| 91丨九色丨国产在线 | 黄色一级免费 | 日韩国产一区二区三区 | 一区二区精品 | 国产伦精品一区二区三区照片91 | 国产一级视频在线播放 | 久久99国产精一区二区三区 | 国产日韩欧美 | 国内久久 | 在线观看精品 | 日韩一区二区成人 | 亚洲国产精品久久久 | 色婷婷九月 | 日韩超碰在线 | 91网站在线看 | 国产精品免费一区二区三区四区 | 午夜影院在线视频 | 狠狠干影院 | 日韩视频三区 | 亚洲人成人一区二区在线观看 | 日韩成人在线网址 |