相关疑难解决方法(0)

pandas dataframe str.contains()AND操作

df(Pandas Dataframe)有三行.

some_col_name
"apple is delicious"
"banana is delicious"
"apple and banana both are delicious"
Run Code Online (Sandbox Code Playgroud)

df.col_name.str.contains("apple|banana")

将捕获所有行:

"apple is delicious",
"banana is delicious",
"apple and banana both are delicious".
Run Code Online (Sandbox Code Playgroud)

如何在str.contains方法上应用AND运算符,以便它只捕获包含苹果和香蕉的字符串?

"apple and banana both are delicious"
Run Code Online (Sandbox Code Playgroud)

我想抓住包含10-20个不同单词的字符串(葡萄,西瓜,浆果,橙子,......等)

python string dataframe pandas

18
推荐指数
5
解决办法
2万
查看次数

标签 统计

dataframe ×1

pandas ×1

python ×1

string ×1