def prctile(x, p=(0.0, 25.0, 50.0, 75.0, 100.0)):
 def _interpolate(a, b, fraction):
  u"Returns the point at the given fraction between a and b, where\n        'fraction' must be between 0 and 1.\n        "
  return (a + ((b - a) * fraction))
 per = np.array(p)
 values = np.sort(x, axis=None)
 idxs = ((per / 100) * (values.shape[0] - 1))
 ai = idxs.astype(int)
 bi = (ai + 1)
 frac = (idxs % 1)
 cond = (bi >= len(values))
 if per.ndim:
  ai[cond] -= 1
  bi[cond] -= 1
  frac[cond] += 1
 elif cond:
  ai -= 1
  bi -= 1
  frac += 1
 return _interpolate(values[ai], values[bi], frac)

def prctile ( x , p = ( 0.0 , 25.0 , 50.0 , 75.0 , 100.0 ) ) : def _interpolate ( a , b , fraction ) : return ( a + ( ( b - a ) * fraction ) ) per = np . array ( p ) values = np . sort ( x , axis = None ) idxs = ( ( per / 100 ) * ( values . shape [ 0 ] - 1 ) ) ai = idxs . astype ( int ) bi = ( ai + 1 ) frac = ( idxs % 1 ) cond = ( bi >= len ( values ) ) if per . ndim : ai [ cond ] -= 1 bi [ cond ] -= 1 frac [ cond ] += 1 elif cond : ai -= 1 bi -= 1 frac += 1 return _interpolate ( values [ ai ] , values [ bi ] , frac )
return the percentiles of *x* .