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
Cannot convert unicode or char dtype to longer fixed size #6484
Comments
@elfjes thank you for reporting this, I can confirm the behaviour you describe. I can also confirm that the code will work fine without the Numba decorators. |
@esc thanks for your reply. Is there any other way I might be able to do this within numba? Would it perhaps be possible to do something with an |
I think this is due to a number of valid casts having not been implemented. One path that should work is this: import numba
import numpy as np
@numba.njit(boundscheck=True)
def assign_in_array(source, destination):
for i in range(len(destination)):
destination[i] = str(source[i])
if __name__ == '__main__':
src = np.array(['val'], dtype='U4')
dst = np.empty_like(src, dtype='U8')
assign_in_array(src, dst) |
@stuartarchibald I tried that, but only with 'S4' and 'S8' and that failed too with:
|
@esc I anticipate it would fail given that implemented casts do not cover that case. |
I have re-labelled this as a feature request to add the missing casts. |
Reporting a bug
visible in 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).
I'm trying to increase the (fixed) length string/unicode dtype of an array. I've tried a number of ways, but none of them work. I think the following two methods should work however, but fail with the error given in the comments:
Is there any other way that might work?
The text was updated successfully, but these errors were encountered: