The following code should work:
[x for x in xrange(len(a)) if a[x:x+len(b)] == b]
Returns the index at which the pattern starts.
More Related Contents:
- Is there a NumPy function to return the first index of something in an array?
- Understanding NumPy’s einsum
- Intuition and idea behind reshaping 4D array to 2D array in NumPy
- Is there any numpy group by function?
- Computing the correlation coefficient between two multi-dimensional arrays
- Numpy sum elements in array based on its value
- Efficiently return the index of the first value satisfying condition in array
- how does multiplication differ for NumPy Matrix vs Array classes?
- How to save and load numpy.array() data properly?
- How do I access the ith column of a NumPy multidimensional array?
- Interweaving two numpy arrays
- python how to pad numpy array with zeros
- How can I check if one two-dimensional NumPy array contains a specific pattern of values inside it?
- Finding the consecutive zeros in a numpy array
- Numpy ValueError: setting an array element with a sequence. This message may appear without the existing of a sequence?
- Numpy: Fix array with rows of different lengths by filling the empty elements with zeros
- Numpy – add row to array
- How to split/partition a dataset into training and test datasets for, e.g., cross validation?
- Selecting Random Windows from Multidimensional Numpy Array Rows
- Find elements of array one nearest to elements of array two
- how to perform max/mean pooling on a 2d array using numpy
- How to find the index of a value in 2d array in Python?
- find and delete from more-dimensional numpy array
- What is the difference between ndarray and array in NumPy?
- Initialise numpy array of unknown length
- Creating same random number sequence in Python, NumPy and R
- Stocking large numbers into numpy array
- Why does numpy.linalg.solve() offer more precise matrix inversions than numpy.linalg.inv()?
- load csv into 2D matrix with numpy for plotting
- Efficient dot products of large memory-mapped arrays