numpy / numpy/numpy

ENH: resize could have `order="A"` kwarg for better F-order support

Open
#22,018 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

00 - Bug
Dominant language
Python
Stars
32.8k
Forks
12.8k
Avg merge
1d 7h
Merged PRs (30d)
197

Description

Describe the issue:

Many functions such as np.ones allow you to specify whether the data is stored by row and then column, or column and then row. Seemingly, the default option is always chosen when there is only one column of data, regardless of what is specified.

Reproduce the code example:
import numpy as np

A = np.ones((4, 2))
A.resize((4, 3))
print(A)

B = np.ones((4, 2), order='F')
B.resize((4, 3))
print(B)

C = np.ones((4, 1))
C.resize((4, 2))
print(C)

#does not behave as expected
D = np.ones((4, 1), order='F')
D.resize((4, 2))
print(D)
Error message:

No response

NumPy/Python version information:

1.23.1 3.10.5 (main, Jun 7 2022, 21:08:59) [GCC 11.3.0]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no implementation file or test. Start by running the reproducer with NumPy 1.23.1 and inspecting the ndarray.resize API and its handling of Fortran-ordered arrays; done means defining the order="A" behavior and covering the one-column case with regression tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.