Closed
Description
This line works on numpy 1.9.3 but errors on 1.10.1 (current conda version):
np.concatenate(np.vsplit(np.zeros((2,2)), [1, 1]))
It's because the split call has an empty array with the wrong shape, as indicated in the FutureWarning that prints:
In [1]: np.vsplit(np.zeros((2,2)), [1, 1])
/Users/mattjj/miniconda/lib/python2.7/site-packages/numpy/lib/shape_base.py:431: FutureWarning: in the future np.array_split will retain the shape of arrays with a zero size, instead of replacing them by `array([])`, which always has a shape of (0,).
FutureWarning)
Out[1]: [array([[ 0., 0.]]), array([], dtype=float64), array([[ 0., 0.]])]
However, it looks like in 1.9.3 this wasn't the case:
In [1]: np.vsplit(np.zeros((2,2)), [1, 1])
Out[1]:
[array([[ 0., 0.]]),
array([], shape=(0, 2), dtype=float64),
array([[ 0., 0.]])]
This seems like a regression. Is this intended behavior?
(I'm on OS X using conda and Python 2.7.10, and switching between versions with conda install numpy
and conda install numpy=1.9.3
.)