Skip to content

Instantly share code, notes, and snippets.

@eriktaubeneck
Created November 1, 2013 17:04
Show Gist options
  • Save eriktaubeneck/7268489 to your computer and use it in GitHub Desktop.
Save eriktaubeneck/7268489 to your computer and use it in GitHub Desktop.
Function for finding the percentile of a value `v` among a list of values `l`.
def percentile_at(l,v):
n = len(l)
x = len({i for i in l if i <= v})
return int(round(100*x/float(n)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment