Skip to content
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

MAINT: Numpy 2.0 deprecations for row_stack and in1d #26566

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

ksunden
Copy link
Member

@ksunden ksunden commented Aug 21, 2023

PR summary

Remove usage of soon to be deprecated methods in numpy.

Part of #26422, xref numpy/numpy#24445

Keeping this in draft until the numpy PR is merged, in case they revert some of the changes.

PR checklist

@ksunden
Copy link
Member Author

ksunden commented Aug 21, 2023

My only real qualm with this is now mixing vstack with column_stack... The latter is kept because it has different semantics (particularly for 1-D arrays) than hstack

That makes me wonder if arguing for keeping row_stack is a good idea (it is just an alias, but it is a bit nicer to have consistent names in the same part of the code, sooo)

Alternatively, we could rework that code to use hstack (which may involve adding dimensions to some 1-d arrays, haven't looked too closely)

@mtsokol
Copy link
Contributor

mtsokol commented Aug 22, 2023

Hi! The row_stack is being removed as one of the NEP 52 goals is have each function in exactly one place (so aliases and multiple locations of the same function will be removed).
That's correct, to get the same semantics for column_stack and hstack for 1d arrays it would require:

a = np.array([1,2,3])
np.hstack([a[:,None], a[:,None]])  # np.column_stack([a, b])

@ngoldbaum
Copy link
Contributor

numpy/numpy#24445 is looking ready to merge, does this still need work?

@ksunden ksunden marked this pull request as ready for review August 30, 2023 16:03
@oscargus oscargus added this to the v3.8.0 milestone Aug 31, 2023
@oscargus oscargus merged commit 6b0f313 into matplotlib:main Aug 31, 2023
39 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 31, 2023
ksunden added a commit that referenced this pull request Aug 31, 2023
…566-on-v3.8.x

Backport PR #26566 on branch v3.8.x (MAINT: Numpy 2.0 deprecations for row_stack and in1d)
@ksunden ksunden mentioned this pull request Sep 15, 2023
5 tasks
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

Successfully merging this pull request may close these issues.

None yet

5 participants