10 Sep
2010
10 Sep
'10
4:46 a.m.
Hi Folks, I have array (numpy.ndarray object) with non-zero elements cumulated 'somewhere' (like a array([[0,0,0,0],[0,1,1,0],[0,0,1,0],[0,0,0,0]])) and I need sub-array with just non-zero elements (array([[1,1],[0,1]])). I can do this with iterating throught an array, but I also found some magic tricks with boolen operators in indexing and nonzero function, but it is still not clear to me, how to use it. I am sure that this will be pretty easy for those who are familiar with this kind of array indexing and I hope I will be one of them soon :-). Thanks a lot Radek
4969
Age (days ago)
4969
Last active (days ago)
3 comments
2 participants
participants (2)
-
Pauli Virtanen
-
Radek Machulka