MAINT: Numpy 2.0 deprecations for row_stack and in1d by ksunden · Pull Request #26566 · matplotlib/matplotlib
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
- "closes #0000" is in the body of the PR description to link the related issue
- [n/a] new and changed code is tested
- [n/a] Plotting related features are demonstrated in an example
- [n/a] New Features and API Changes are noted with a directive and release note
- [n/a] Documentation complies with general and docstring guidelines
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)
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])
ksunden
marked this pull request as ready for review
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request
Aug 31, 2023ksunden 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)
pllim
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters