Created
October 20, 2015 13:50
-
-
Save twidi/fe0541273481899dbdfa to your computer and use it in GitHub Desktop.
percentage of true values
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
In [1]: from itertools import chain | |
In [2]: from collections import Counter | |
In [3]: x = [[True, False, True], [True]] | |
In [4]: y = list(chain.from_iterable(x)) | |
In [5]: c = Counter(y) | |
In [6]: c[True] / len(y) * 100 | |
Out[6]: 75.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment