SHARE
TWEET

Untitled

a guest Apr 22nd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def percentile_at(table, x, axis=1, freq_count=10, interval=10, delta_between_group=0.01):
  2.     C = np.cumsum(table, axis=axis)
  3.     N = np.sum(table, axis=axis)
  4.     P = x * N  # cumulative freq of x
  5.    
  6.     compare = C > np.tile(P, (freq_count, 1)).T
  7.    
  8.     index = freq_count - np.sum(compare, axis=axis)  # index of groups that x on
  9.     I = range(index.shape[0])
  10.    
  11.     L = interval * index + delta_between_group/2
  12.     CF = C.values[I, index-1]
  13.    
  14.     return L + interval * ((P - CF) / table.values[I, index])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top