Last active
December 18, 2015 21:39
-
-
Save IanHopkinson/5849344 to your computer and use it in GitHub Desktop.
A demonstration of doctests
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
def threshold_above(hist, threshold_value): | |
""" | |
>>> threshold_above(collections.Counter({518: 10, 520: 20, 530: 20, 525: 17}), 15) | |
[520, 530, 525] | |
""" | |
if not isinstance(hist,collections.Counter): | |
raise ValueError("requires collections.Counter") | |
above = [k for k, v in hist.items() if v > threshold_value] | |
return above |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment