I'm pretty sure I wrote the offending line in the vstack() docs. The original motivation for stack() was that stacking behavior of hstack(), vstack() and dstack() was somewhat inconsistent, especially with regard to lower dimensional input. stack() is conceptually much simpler and more general.
That said, if you know vstack() and find it useful, great, use it. It is not going away in NumPy. We don't remove functions just because there's a better alternative API, but rather use the docs to try to point new users in a better direction. On Thu, Nov 9, 2017 at 2:11 PM Eric Wieser <wieser.eric+nu...@gmail.com> wrote: > I think the primary problems with it are: > > - A poor definition of “vertical” in the world of stacked matrices - > in np.linalg land, this means axis=-2, but in vstack land, it means > axis=0. > - Mostly undocumented auto-2d behavior that doesn’t make you think > well enough about dimensions. Numpy deliberately distinguishes between “row > vectors” (1, N) and vectors (N,), so it’s a shame when APIs like vstack > and np.matrix try to hide this distinction. > > Eric > > On Thu, 9 Nov 2017 at 13:59 Mark Bakker <mark...@gmail.com> wrote: > > On 11/09/2017 04:30 AM, Joe wrote: >>> > Hello, >>> > >>> > I have a question and hope that you can help me. >>> > >>> > The doc for vstack mentions that "this function continues to be >>> > supported for backward compatibility, but you should prefer >>> > np.concatenate or np.stack." >>> > >>> > Using vstack was convenient because "the arrays must have the same >>> shape >>> > along all but the first axis." >>> > >>> > So it was possible to stack an array (3,) and (2, 3) to a (3, 3) array >>> > without using e.g. atleast_2d on the (3,) array. >>> > >>> > Is there a possibility to mimic that behavior with np.concatenate or >>> > np.stack? >>> > >>> >> > Joe >>> >>> >> Can anybody explain why vstack is going the way of the dodo? >> Why are stack / concatenate better? What is 'bad' about vstack? >> >> Thanks, >> >> Mark >> _______________________________________________ >> NumPy-Discussion mailing list >> NumPy-Discussion@python.org >> https://mail.python.org/mailman/listinfo/numpy-discussion >> > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@python.org > https://mail.python.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion