Merge two arrays into an list of arrays
<p>Hi I am trying compile a bunch of arrays that I have in a dictionary using a for loop and I cant seem to find proper solution for this.</p>

<p>Essentially what I have in a simplified form:</p>

<pre><code>dict['w1']=[1,2,3]
dict['w2']=[4,5,6]
dict['w3']=[7,8]

x = []
for i in range(3):
    x = np.concatenate([x],[dict['w'+str(i+1)].values],axis=0)
</code></pre>

<p>what it gives:</p>

<pre><code>x = [1,2,3,4,5,6,7,8]
</code></pre>

<p>what I want:</p>

<pre><code>x = [[1,2,3],[4,5,6],[6,7]]
</code></pre>

<p>I want to use the for loop because I have too many arrays to 'compile' and cant key in them one by one would be very inefficient. This way I can use the created array to plot a boxplot directly.</p>

<p>A simiiliar question exists with no loop requirement but still does not have proper solution. <a href="http://stackoverflow.com/questions/12020872/array-of-arrays-python-numpy">Link</a></p>

<p>If you mean lists and not dictionarys, then you're looking for the zip command.</p>

<p>Zip (w1,w2,w3)</p>

python arrays python-3.x numpy jupyter