Skip to content
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

Converting empty numpy char array fails #1662

Closed
dipterix opened this issue Sep 8, 2024 · 1 comment · Fixed by #1672
Closed

Converting empty numpy char array fails #1662

dipterix opened this issue Sep 8, 2024 · 1 comment · Fixed by #1672

Comments

@dipterix
Copy link
Contributor

dipterix commented Sep 8, 2024

Failed to convert array([], dtype='<U1') to R.

reprex:

np <- reticulate::import("numpy", convert = FALSE)
arr <- np$array(list("a"), dtype = "U1")
print(arr)
#> array(['a'], dtype='<U1')
reticulate::py_to_r(arr)
#> [1] "a"

arr <- np$array(list(), dtype = "U1")
print(arr)
#> array([], dtype='<U1')
# expected character(0L)
reticulate::py_to_r(arr)
#> Iteration of zero-sized operands is not enabled

Session/Versions:

R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.5
Python version:        3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:34:54) [Clang 16.0.6 ]
numpy version:  1.26.4
@t-kalinowski
Copy link
Member

This is fixed in the development version now. Thank you for reporting!

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

Successfully merging a pull request may close this issue.

2 participants