I would use pandas for this, as it built into vectorized string methods :
# create some example data In [266]: words = np.asarray(['aafrica', 'Aasia', 'canada', 'Camerun', 'jameica', 'java', 'duesseldorf', 'dumont', 'zzenegal', 'zZig']) In [267]: many_words = words.take(np.random.random_integers(words.size - 1, size=1000))
Pandas uses numpy and matplotlib , but makes some things more convenient.
You can simply build your results as follows:
In [26]: s = pd.Series({'aa':4, 'ca':6, 'ja':9, 'du':10, 'zz':1}) In [27]: s.plot(kind='bar', rot=0) Out[27]: <matplotlib.axes.AxesSubplot at 0x5720150>

source share