I am trying to build a histogram of counts… so I create buckets.
I know I could just go through and append a bunch of zeros i.e something along these lines:

buckets = []
for i in xrange(0,100):
    buckets.append(0)

Is there a more elegant way to do it? I feel like there should be a way to just declare an array of a certain size.

I know numpy has numpy.zeros but I want the more general solution

10 Answers
10

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *