Say I make a weird little array:
>>> a = np.array([[[1,2,3],4],[[4,5,6],5]])
>>> a
array([[[1, 2, 3], 4],
[[4, 5, 6], 5]], dtype=object)
And then take a the first column as a slice:
>>> b = a[:,0]
>>> b
array([[1, 2, 3], [4, 5, 6]], dtype=object)
>>> b.shape
(2,)
Say I now want to reshape b so that its shape is (2,3):
>>> b.reshape((-1,3))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: total size of new array must be unchanged
I presume that numpy is treating each array in b as an object rather than an array in and of itself. The question is, is there a good way of doing the desired resize?