[Numpy-discussion] [Newbie] Matching a subarray

Dani Marti daniel.marti at upf.edu
Wed Jan 25 08:35:01 CST 2006


Hi all,

I have a long 1D boolean array. I'd like to know where a certain
'sub'array (like, e.g., ([1,1,1,1,1,1])) occurs in the array. That is, I
want the index of the first occurrence of a subarray in an array,
avoiding the use of explicit loop structures to carry out the search.

I am sorry if this happens to be a trivial question, but I was not able
to find the answer from the documentation.

Thanks a lot,

dani





More information about the Numpy-discussion mailing list