Skip to content

Inconsistent concatenate behaviour #5759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pbazant opened this issue Apr 9, 2015 · 4 comments
Closed

Inconsistent concatenate behaviour #5759

pbazant opened this issue Apr 9, 2015 · 4 comments

Comments

@pbazant
Copy link

pbazant commented Apr 9, 2015

Numpy under Python 2.7.9:

In [10]: np.version.version
Out[10]: '1.9.1'

In [11]: np.concatenate(([[1,2]],[[3,4]]), axis = 10)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-11-2a6d0286a78f> in <module>()
----> 1 np.concatenate(([[1,2]],[[3,4]]), axis = 10)

IndexError: axis 10 out of bounds [0, 2)

In [12]: np.concatenate(([1,2],[3,4]), axis = 10)
Out[12]: array([1, 2, 3, 4])

I would expect the second use of concatenate to throw an exception, too. Is this behaviour intentional?

@jaimefrio
Copy link
Member

There is a deprecation warning in place, try this:

>>> import warnings
>>> warnings.simplefilter('always')
>>> np.concatenate(([1,2],[3,4]), axis = 10)
__main__:1: DeprecationWarning: axis != 0 for ndim == 1; this will raise an error in future versions of numpy
array([1, 2, 3, 4])

It was introduced in 21a1d73 and 4475ead, almost 3 years ago. Perhaps 1.10 could be the deprecated future?

@njsmith
Copy link
Member

njsmith commented Apr 9, 2015

I guess we should look up when the first NumPy release containing those
commits was instead of just when they were written, but assuming that's
also 2+ years ago then raising an error in 1.10 seems reasonable to me.
On Apr 9, 2015 10:39 AM, "Jaime" notifications@github.com wrote:

There is a deprecation warning in place, try this:

import warnings
warnings.simplefilter('always')
np.concatenate(([1,2],[3,4]), axis = 10)
main:1: DeprecationWarning: axis != 0 for ndim == 1; this will raise an error in future versions of numpy
array([1, 2, 3, 4])

It was introduced in 21a1d73
21a1d73
and 4475ead
4475ead,
almost 3 years ago. Perhaps 1.10 could be the deprecated future?


Reply to this email directly or view it on GitHub
#5759 (comment).

@jaimefrio
Copy link
Member

This comment seems to indicate it went into effect in 1.7.

@ahaldane
Copy link
Member

ahaldane commented Oct 6, 2018

Fixed by #8584. Closing.

@ahaldane ahaldane closed this as completed Oct 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants