def prctile_rank(x, p):
 if (not cbook.iterable(p)):
  p = np.arange((100.0 / p), 100.0, (100.0 / p))
 else:
  p = np.asarray(p)
 if ((p.max() <= 1) or (p.min() < 0) or (p.max() > 100)):
  raise ValueError(u'percentiles should be in range 0..100, not 0..1')
 ptiles = prctile(x, p)
 return np.searchsorted(ptiles, x)

def prctile_rank ( x , p ) : if ( not cbook . iterable ( p ) ) : p = np . arange ( ( 100.0 / p ) , 100.0 , ( 100.0 / p ) ) else : p = np . asarray ( p ) if ( ( p . max ( ) <= 1 ) or ( p . min ( ) < 0 ) or ( p . max ( ) > 100 ) ) : raise ValueError ( u'percentiles should be in range 0..100, not 0..1' ) ptiles = prctile ( x , p ) return np . searchsorted ( ptiles , x )
return the rank for each element in *x* .