How can I plot a histogram in pandas using nominal values?
ser = Series(['one', 'two', 'three', 'two', 'two'])
How do I plot a basic histogram of these values?
Here is an ASCII version of what I'd want to see in matplotlib:
X X X X ------------- one two three
I'm tired of seeing:
TypeError: cannot concatenate 'str' and 'float' objects
You could use the value_counts method:
In : ser.value_counts() Out: two 3 one 1 three 1
and then plot this as a bar chart:
Edit: I noticed that this doesn't keep the desired order. If you have a list/Series for this ordering (in this case ser[:3] will do) you can reindex before plotting:
In : ser.value_counts().reindex(ser[:3]) Out: one 1 two 3 three 1