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
Slicing a string from a Numpy structured array throws an error #5802
Comments
I just found a work around. If you parse the string from the structured array using str(), it works. However, I am not sure what the performance penalty is for doing so??
|
I also wanted to point out that some string methods do work as expected. E.g. .split():
Hope this information is helpful |
Thanks for the report. In the first post #5802 (comment) I think that this won't work as the type of the returned thing will depend on the values in the slice, e.g. With respect to your work around #5802 (comment) the performance penalty is likely that a string buffer has to be allocated and the characters copied in, without looking at the machine code I'd guess that it cannot be optimised away as it's a change of internal representation. As to some method's working, it's because the character array will "look like" a string for the method call if the types can be statically determined. |
Closing this question as it seems to be resolved. Numba now has a discourse forum https://numba.discourse.group/ which is great for questions like this, please do consider posting there in future :) Thanks! |
This works:
But when jitting it, it throws an error:
Invalid use of Function() with argument(s) of type(s): ([unichr x 25], slice)
numba: 0.49.1
numpy: 1.18.4
python: 3.7.1
the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).
to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).
The text was updated successfully, but these errors were encountered: