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
one two three

I'm tired of seeing:

TypeError: cannot concatenate 'str' and 'float' objects


You could use the value_counts method:

In [10]: ser.value_counts()
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 [12]: ser.value_counts().reindex(ser[:3])
one      1
two      3
three    1

Need Your Help

Upload files to Firebase Storage using Node.js

javascript node.js firebase gcloud firebase-storage

I'm trying to understand how to upload files in Firebase Storage, using Node.js. My first try was to use the Firebase library:

Conda command not found

python zsh anaconda miniconda

I've installed Miniconda and have added the environment variable export PATH="/home/username/miniconda3/bin:$PATH" to my .bachrc and .bash_profile but still can't run any conda commands in my termi...