📌  相关文章
📜  pandas 多个字符串包含 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:46.545000             🧑  作者: Mango

代码示例1
# credit to Stack Overflow user in the source link

>>> df = pd.Series(['cat','hat','dog','fog','pet'])
>>> searchfor = ['og', 'at']
>>> df[df.str.contains('|'.join(searchfor))]

0    cat
1    hat
2    dog
3    fog
dtype: object