擅长:python、mysql、java
<p>也许这不是最好的答案:</p>
<pre><code>def count(text, target):
words = text.split()
counter = 0
for word in words:
if word == target:
counter += 1
return counter
df['counter'] = df.apply(lambda row: count(row['text'], target="#"),axis=1)
sum(df["counter"])
</code></pre>