Compare Across Arrays by Index in Python
<p>I'm looking to compare values of several arrays by index.</p>

<p>For example, if I have</p>

<pre><code>a = [1, 1, 1, 1, 1, 1]
b = [2, 2, 5, 5, 5, 2]
c = [3, 3, 3, 3, 3, 3]
</code></pre>

<p>I'd like to be able to determine that index 2 of array b is out of range of a and c.</p>

<p>Even more so, I'd like it to output the index of the third value which is out of range in a row.</p>

<p>So far, I have something like: </p>

<pre><code>av = [1,1,1,1,1,1,1,1,1,1]
sd = [0.1, 0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.1, 0.1]

x = 1.1

counter = 0
for index, value in enumerate(np.sum([av,sd], axis=0)):
    if value &gt; x:
        counter += 1
    else: 
        counter = 0   
    if counter &gt;= 3:
        print "misbehaving channels"
        print(index, value)
        break 
</code></pre>

<p>which will output (4, 1.2), telling me the index after it has been >x for 3 elements in a row, and the value at that index. </p>

<p>However, as you can see, this doesn't compare across arrays, just where x = 1.1</p>

<p>So, going back to the original example, ideally, the output would be something like (4, 5), where the index is 4, value is 5.</p>

<p>Thanks, any help would be greatly appreciated.</p>