Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def percentile_at(table, x, axis=1, freq_count=10, interval=10, delta_between_group=0.01):
- C = np.cumsum(table, axis=axis)
- N = np.sum(table, axis=axis)
- P = x * N # cumulative freq of x
- compare = C > np.tile(P, (freq_count, 1)).T
- index = freq_count - np.sum(compare, axis=axis) # index of groups that x on
- I = range(index.shape[0])
- L = interval * index + delta_between_group/2
- CF = C.values[I, index-1]
- return L + interval * ((P - CF) / table.values[I, index])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement