nDimensional sparse histogram in python.
Alex Martelli
aleaxit at yahoo.com
Wed Feb 1 22:25:32 EST 2006
KraftDiner <bobrien18 at yahoo.com> wrote:
> Cool.
> Ok so my histogram class had two methods 1) To increment a point and 2)
> to get the point.
>
> def class histo:
> def __init__(self):
> histo = {}
> def update(point):
> '''searches the dictionary for point and if it exists increment the
> value.
> if it doesn't exist set the value to 1'''
def update(self, point):
self.histo[point] = 1 + self.histo.get(point, 0)
>
> def get(point):
def (self, point):
actually.
> return self.histo[point]
>
> I'm not sure how to code up the update routine...
See above.
Alex
More information about the Python-list
mailing list