Count occurrences of a value in a Series
<p>I am newbie to Python. I am reading a csv file (with 3 columns: lib, imports, import_tuples). How can I count the number of occurrences of a value appears in the second column in the the column?</p>

<p>Example:</p>

<pre><code>lib,imports,import_tuples 
lib1,"[0, 1, 2, 3, 4, 5]","[[5, 1, 2], [2,1,3],[2, 4, 1]]" 
lib2,"[4, 65, 99, 100]","[[4, 65, 100], [100, 4],[99, 65]]"

Expected Output (for lib1)
0 1 2 3 4 5
0 3 3 1 1 1 
</code></pre>

<hr>

<pre><code>import pandas
from collections import Counter
df = pandas.read_csv('temp_data.csv')
myList = second.values.T.tolist()

c = df["import_tuples"].str.split(',').apply(Counter)
data = pandas.DataFrame({n: c.apply(lambda x: x.get(n, 0)) for n in myList})
data =  c.to_frame()
</code></pre>