Created
July 24, 2018 11:43
-
-
Save vinaykudari/ca34ebf158518364cd32d2487051b0ec to your computer and use it in GitHub Desktop.
Flat non zero
This file contains hidden or 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
a = np.arange(2,10,2) | |
print(a) | |
>> [2 4 6 8] | |
print(a>5) | |
>> [False False True True] | |
b = np.flatnonzero(a>1) | |
print(b) | |
>> [2 3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment