merge arrays in Python
<p>Input:</p>

<pre><code>a[0] = [0, 1, 2]
a[1] = [0, 2, 2]
a[2] = [100, 200, 300]
</code></pre>

<p>Output1:</p>

<pre><code>output1
&gt;&gt; [100, 203, 304]
</code></pre>

<p>Output2:</p>

<pre><code>output2
&gt;&gt; [{0:2, 100:1}, {1:1, 2:1, 200:1}, {2:2, 300:1}]
</code></pre>

<p>In other words, output1 calculate the sum of each column, and output2 statistics the occurrence of each number in each column.</p>

<p>(Actually, a is a matrix of 4000*400000)
Does anyone have ideas how to do this efficiently in Python?</p>
