如何过滤包含 Polars 列表中的值的字符串行

问题描述 投票:0回答:0

如果你有一个值列表和一个带有一列文本的 Polars 数据框。你想过滤到只包含列表中项目的行,你会怎么写?

a_list = ['a', 'b', 'c' ]

df = pl.DataFrame( {'col1': ['I am just a string', 'one more, but without the letters', 'we want, a, b, c,', 'Nothing here']} )

我假设它有一些结合/使用

.is_in(a_list)
.str.contains()
的东西,但我没能让它工作。

contains python-polars isin
© www.soinside.com 2019 - 2024. All rights reserved.