start with
NumPy Reference — NumPy v1.9 Manual
Tentative NumPy Tutorial -
for numpy python packages
http://www.lfd.uci.edu/~gohlke/pythonlibs/
other links
http://rintintin.colorado.edu/~wajo8931/docs/jochem_aag2011.pdf
I will put these on my reference page where I have posted a few articles
Dan Patterson's Blog
particular things like
Collections in numpy: producing frequency distributions and graphing
for the graphing component
you can take a numpy array, flatten it and even use collections to simplify class counts
>>> import numpy as np
>>> import collections
>>> arr = [[1,2,3],[1,2,3],[1,1,2]] # assume that this is a raster
>>> arr = np.array(arr) # you will use RasterToNumpyArray to get this
arr
array([[1, 2, 3],
[1, 2, 3],
[1, 1, 2]])
>>> flat = arr.flatten()
>>> flat
array([1, 2, 3, 1, 2, 3, 1, 1, 2])
then use the following as a quick solution
>>>
but in your case collections will help but
>>> import collections
>>> seq
[23, 24, 6, 24, 24, 23]
>>> dict = collections.Counter(seq)
>>> dict
Counter({24: 3, 23: 2, 6: 1})
>>> keys = dict.keys()
>>> keys
[24, 6, 23]
>>> values = dict.values()
>>> values
[3, 1, 2]
>>>