![](/img/trans.png)
[英]Pandas: Remove all rows where any of the column contains a certain substring
[英]How to find all rows contains certain substring, Python Pandas
我有一個系列看起來像:
10 1.01
12 C201311
20 1.02
21 2A8272
22 2A8067
...
370 G26907
373 G20617
374 G20618
376 G20617
377 G20618
簡而言之,所有行都包含“。” 是不需要的
我正在嘗試應用 count() 方法,但沒有運氣df["Part No."].count(".") > 0
任何人都知道如何擺脫不需要的行?
你可以做contains
m=df["Part No."].str.contains('[.]')
df=df[m]
另外df["Part No."].str.count('[.]') > 0
工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.