import pandas as pd
data0 = [0,1,2,0,1,0,2,0]
pd.value_counts(data0)
輸出每個數出現的頻數:
0 4
2 2
1 2
(0出現4次,2出現2次,1出現兩次)