displaying maximum difference between arrays as a list
<p>I have 2 two-dimensional arrays, where each row represents a time and each column represents an item. I want to find the maximum difference between the two arrays for each item. (I don't particularly care about finding where in time that greatest difference is at this point.) </p>

<p>I want to create a list of these maximum differences so that later I can find the largest 15 of that list. </p>

<p>So far, I've tried to accomplish this task by doing something this:</p>

<pre><code>import numpy as np

array1 = [[1, 2, 3, 4, 5], [2, 4, 6, 8, 10], [3, 6, 9, 12, 15]]
array2 = [[6, 7, 8, 9, 10], [11, 22, 33, 44, 55], [1, 4, 9, 16, 25]]

num_items = np.shape(array1)[1]
num_timesteps = np.shape(array1)[0]

for counter in np.arange(0, num_items):
    for counter2 in np.arange(0, num_timesteps):
        diff_list = []
        diff = array1[counter2][counter] - array2[counter2][counter]
        diff = abs(diff)
        diff_list.append(diff)
    max_diff = []
    max_diff.append(max(diff_list))
    print max_diff
</code></pre>

<p>However, this doesn't print an actual list. Instead, it gives me one list per item with the maximum difference for that item.</p>

<p>Desired output: [2, 2, 0, 4, 10]</p>

<p>Current output: [2] [2] [0] [4] [10]</p>

<p>So, my question is: How can I find the maximum differences between my two arrays and put them in a single list?</p>