How to count the number of times a word appears in each row of a csv file, in python
<p>I have a csv document in which each row contains a string of words. For each row, I want to know how many times each words appears in that row, how would I go about this?</p>

<p>Thanks</p>

<p>Use <code>collections.Counter</code>:</p>

<pre><code>from collections import Counter
z = ['a', 'b', 'c', 'd', 'a']
u = Counter(z)
print(u['a'])  # 2
print(u['b'])  # 1
</code></pre>

python csv