Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Should be able to convert string arrays to bool_ #12252

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

Closed
charris opened this issue Oct 23, 2018 · 2 comments
Closed

Should be able to convert string arrays to bool_ #12252

charris opened this issue Oct 23, 2018 · 2 comments

Comments

@charris
Copy link
Member

charris commented Oct 23, 2018

NumPy can create boolean arrays out of strings, but cannot convert string arrays to bool_. I think we should follow Python here and assign truth values to strings.

Reproducing code example:

>>> import numpy as np
>>> np.array('N', dtype='?')
array(True)
>>> np.array('N').astype('?')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'N'

Error message:

Numpy/Python version information:

@eric-wieser
Copy link
Member

Duplicates #9875, I think

@mattip
Copy link
Member

mattip commented Apr 29, 2019

Closing as a duplicate of #9875. Please reopen if I misunderstood

@mattip mattip closed this as completed Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants