def _bincount_slow(x, weights=None, minlength=None):
 if (weights is not None):
  raise NotImplementedError()
 if (minlength is None):
  rlen = (np.max(x) + 1)
 else:
  rlen = max((np.max(x) + 1), minlength)
 rval = np.zeros(rlen, dtype='int')
 for xi in np.asarray(x).flatten():
  rval[xi] += 1
 return rval

def _bincount_slow ( x , weights = None , minlength = None ) : if ( weights is not None ) : raise NotImplementedError ( ) if ( minlength is None ) : rlen = ( np . max ( x ) + 1 ) else : rlen = max ( ( np . max ( x ) + 1 ) , minlength ) rval = np . zeros ( rlen , dtype = 'int' ) for xi in np . asarray ( x ) . flatten ( ) : rval [ xi ] += 1 return rval
backport of np .