Skip to content

Instantly share code, notes, and snippets.

@vinaykudari
Created July 24, 2018 11:43
Show Gist options
  • Save vinaykudari/ca34ebf158518364cd32d2487051b0ec to your computer and use it in GitHub Desktop.
Save vinaykudari/ca34ebf158518364cd32d2487051b0ec to your computer and use it in GitHub Desktop.
Flat non zero
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