X-No-Archive: yes
Can some one help me improve this block of code...this jus converts the
list of data into tokens based on the range it falls into...but it
takes a long time.Can someone tell me what can i change to improve
it...

def Tkz(tk,data):
     no_of_bins = 10
     tkns = []
     dmax = max(data)+1
     dmin = min(data)
     rng = ceil(abs((dmax - dmin)/(no_of_bins*1.0)))
     rngs = zeros(no_of_bins+1)
     for i in xrange(no_of_bins+1):
          rngs[i] = dmin + (rng*i)
     for i in xrange(len(data)):
          for j in xrange(len(rngs)-1):
               if data[i] in xrange(rngs[j],rngs[j+1]):
                    tkns.append( str(tk)+str(j) )
     return tkns

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to