擅长:python、mysql、java
<p>您需要将值展平到简单的列表和计数值-按<a href="https://docs.python.org/3.6/library/collections.html#collections.Counter" rel="nofollow noreferrer">^{<cd1>}</a>或按<a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.value_counts.html" rel="nofollow noreferrer">^{<cd2>}</a>:</p>
<pre><code>from collections import Counter
s = pd.Series(Counter([y for x in df['Column B'] for y in x]))
print (s)
cat 2
dog 2
tiger 1
italy 1
china 1
japan 1
dtype: int64
</code></pre>
<p>备选方案1:</p>
^{pr2}$
<p>备选方案2:</p>
<pre><code>s = pd.Series(np.concatenate(df['Column B'])).value_counts()
</code></pre>
<p>大数据中的慢替代:</p>
<pre><code>s = pd.Series(df['Column B'].sum()).value_counts()
</code></pre>