MAINT: Numpy 2.0 deprecations for row_stack and in1d by ksunden · Pull Request #26566 · matplotlib/matplotlib

@ksunden

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

@ksunden

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

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

@ngoldbaum

@ksunden ksunden marked this pull request as ready for review

August 30, 2023 16:03

QuLogic

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)

@pllim pllim mentioned this pull request

Sep 6, 2023