Last active
March 23, 2016 19:56
-
-
Save reimai/482f26f6a0abc25996b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: | |
# $ sudo apt-get install python-numpy | |
# $ python percentile.py 95 97 99 99.9 < my_file_with_floats | |
import numpy as np | |
import fileinput | |
import sys | |
lines = [] | |
for line in sys.stdin: | |
lines.append(float(line[:-1])) | |
a = np.array(lines) | |
for p in sys.argv[1:]: | |
print "{}: {}".format(p, np.percentile(a, float(p))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment