How to make a histogram from a list of strings in Python?

前端 未结 8 1245
说谎
说谎 2020-12-03 04:29

I have a list of strings:

a = [\'a\', \'a\', \'a\', \'a\', \'b\', \'b\', \'c\', \'c\', \'c\', \'d\', \'e\', \'e\', \'e\', \'e\', \'e\']

I w

8条回答
  •  Happy的楠姐
    2020-12-03 05:04

    here's a concise all-pandas approach:

    a = ['a', 'a', 'a', 'a', 'b', 'b', 'c', 'c', 'c', 'd', 'e', 'e', 'e', 'e', 'e']
    pd.Series(a).value_counts().plot('bar')
    

提交回复
热议问题