Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: Should row_stack really be deprecated? #26032

Open
@anntzer

Description

@anntzer

Proposed new feature or change:

I understand that row_stack is being deprecated in numpy 2.0 because it is directly an alias for vstack, but sometimes the spelling row_stack is much more consistent when used next to column_stack.
For example I have the following snippet, which computes, for a binary mask, for each pixel, the number of neighboring pixels that are set:

neighbor_count= (np.row_stack([mask[1:, :],np.zeros(mask.shape[1])])+np.row_stack([np.zeros(mask.shape[1]),mask[:-1, :]])+np.column_stack([mask[:,1:],np.zeros(mask.shape[0])])+np.column_stack([np.zeros(mask.shape[0]),mask[:, :-1]]))

Obviously there are other ways to compute this, e.g. by padding first, or with a scipy 2D convolution, or using vstack and hstack and explicitly passing (1, N) column arrays to hstack, but at least in the way it's written above, it would seem less readable to use vstack for the first two terms and column_stack for the last two.

I would therefore like to suggest reverting this deprecation, even if this function is perhaps marked as discouraged or explicitly points to vstack as an alternative. (As an aside, this deprecation does not seem to be caught by ruff's NPY201 rule).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp