📜  数据帧字符串查找计数 - Python 代码示例

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

代码示例1
In [21]: df = pd.DataFrame(['hello', 'world', 'hehe'], columns=['words'])

In [22]: df.words.str.count("he|wo")
Out[22]:
0    1
1    1
2    2
Name: words, dtype: int64

In [23]: df.words.str.count("he|wo").sum()
Out[23]: 4