擅长:python、mysql、java
<p>使用这个,也许它能解决你需要的问题。你知道吗</p>
<pre><code>item, count = np.unique(np.array(df).flatten(), return_counts=True)
pd.DataFrame(count, index=item, columns=['value_counts'])
</code></pre>
<pre><code>value_counts
0 4
1 3
2 1
3 1
</code></pre>