I'm sorry, I think this is a really trivial question, but...
I have a binary Numpy array, mostly zeros with a few ones. I would like to find the coordinates of all the locations where myArray[myArray == 1]
Please can you help me? Thanks
If you are using a list (rather than a numpy array), this answer uses enumerate in both a loop and list comprehension: https://stackoverflow.com/a/17202481/1160876
myArray
, but this could work:[i for i,v in enumerate(myArray) if v == 1]
.