Skip to content

DEP: Make np.insert and np.delete on 0d arrays with an axis an error #15802

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

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Mar 22, 2020

Before this change, the following code worked:

>>> some_0d = np.array(1)
>>> np.insert(some_0d, "some nonsense", 10, axis=0)
array(10)
>>> np.insert(some_0d, "some nonsense", 42, axis="some nonsense")
array(42)

Now these raise AxisError and TypeError, respectively.

delete is exactly the same.

Before this change, the following code worked:

```
>>> some_0d = np.array(1)
>>> np.insert(some_0d, "some nonsense", 10, axis=0)
array(10)
>>> np.insert(some_0d, "some nonsense", 42, axis="some nonsense")
array(42)
```

Now these raise AxisError and TypeError, respectively.

`delete` is exactly the same.
@eric-wieser
Copy link
Member Author

Googling for in the future the special handling of scalars will be removed gives no results other than clones of numpy, so it looks like no one ever ran into this deprecation anyway.

@seberg
Copy link
Member

seberg commented Mar 22, 2020

Probably, I do not feel like bikeshedding on the release notes right now, so going to put this in when the tests are done. Thanks Eric... should have done this years long ago.

@eric-wieser
Copy link
Member Author

Perhaps worth leaving for a few days for someone with release note opinions like @charris or @rgommers to chime in. It's not like anything is blocked by this PR.

@eric-wieser
Copy link
Member Author

Since the other PRs are merged and have very similar structures of release note, may as well merge this one too. Release notes can always be cleaned up at release time.

@eric-wieser eric-wieser merged commit 7d0b3ef into numpy:master Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants