Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Draw 1 histogram with string labels in Python matplotlib
# Where matplotlib do not work (when using string labels for hist())
from collections import Counter
def hist_string(df) :
distincts_count = Counter(df)
df = pd.DataFrame.from_dict(distincts_count, orient='index')
df.plot(kind='bar')
hist_string(titanic.Embarked)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.