8000 BUG: np.ma.take does not work on string arrays · Issue #9206 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: np.ma.take does not work on string arrays #9206

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

Open
eric-wieser opened this issue Jun 2, 2017 · 0 comments
Open

BUG: np.ma.take does not work on string arrays #9206

eric-wieser opened this issue Jun 2, 2017 · 0 comments

Comments

@eric-wieser
Copy link
Member
eric-wieser commented Jun 2, 2017
>>> m = np.ma.array(["hello"])
>>> np.ma.take(m, 0)
  File "\numpy\ma\core.py", line 5670, in take
    out = _data.take(indices, axis=axis, mode=mode)[...].view(cls)
TypeError: string indices must be integers

Since np.string_[...] is not supported

Introduced by #7586

eric-wieser added a commit to eric-wieser/numpy that referenced this issue Jul 3, 2017
np.string_ scalars cannot be indexed with [...], and np.object_ scalars do
not even exist.

The only way to make this work is to not allow a scalar to be produced in the first place - which can be achieved by adding an extra dimension to the indices, and removing it while allowing 0d arrays

Fixes numpy#9206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0