Azure Databricks: 如何在数据框中使用非类似运算符过滤列?

2024-06-16 08:52:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我必须从dataframe中排除对正列中不包含单词spare的行:

"Justification":"WIWYNN | MSASM Spares | 21| MDM: 2520171"

我试过以下几种方法,但都不管用

df= df.where(~ df["Justification"].like("%spares%"))
df = df.where(~(col("Justification").like("%spare%")))
df = df.where("Justification not like '%spare%'")

返回结果的行中,对正列中有备用字,即使我做了否定。你知道吗

I want exact opposite result


Tags: 方法dataframedfnotcolsparewhere单词