答案 0 :(得分:3)
我认为您可以先在列中列出列表,然后使用Counter
:
df = pd.DataFrame({'features':[['a','b','b'],['c'],['a','a']]})
print (df)
features
0 [a, b, b]
1 [c]
2 [a, a]
from itertools import chain
from collections import Counter
print (Counter(list(chain.from_iterable(df.features))))
Counter({'a': 3, 'b': 2, 'c': 1})