def find_threshold(var, percentile):
    (hist, bin_edges) = np.histogram(var, 100)
    cdf = (np.float32(np.cumsum(hist)) / np.sum(hist))
    bin_centers = ((bin_edges[:(- 1)] + bin_edges[1:]) / 2)
    threshold = np.interp((percentile * 0.01), cdf, bin_centers)
    return threshold
def find_threshold(var, percentile):
    (hist, bin_edges) = np.histogram(var, 100)
    cdf = (np.float32(np.cumsum(hist)) / np.sum(hist))
    bin_centers = ((bin_edges[:(- 1)] + bin_edges[1:]) / 2)
    threshold = np.interp((percentile * 0.01), cdf, bin_centers)
    return threshold