On Fri, 24 Jan 2014 17:30:33 +0100, Emanuele Olivetti wrote:
> I just came across this unexpected behaviour when creating
> a np.array() from two other np.arrays of different shape.

The tuple parsing for the construction of new numpy arrays is pretty
tricky/hairy, and doesn't always do exactly what you'd expect.

The easiest workaround is probably to pre-allocate the array:

In [24]: data = [a, c]
In [25]: x = np.empty(len(data), dtype=object)
In [26]: x[:] = data
In [27]: x.shape
Out[27]: (2,)

Regards
Stéfan

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to