PyCall.jl icon indicating copy to clipboard operation
PyCall.jl copied to clipboard

only first 1023 indices are converted

Open tbenst opened this issue 4 years ago • 2 comments

I have a file, stat.npy.

julia> using PyCall
julia> np = pyimport("numpy")
julia> stat = np.load("stat.npy", allow_pickle=true);
julia> cell_centers = map(x->get(x,"med"), stat)
julia> cell_centers[1023]
2-element Vector{Int64}:
 477
 562
julia> cell_centers[1024]
2-element Vector{PyObject}:
 PyObject 211
 PyObject 430
julia> pybuiltin("type")(cell_centers[1023])
PyObject <class 'numpy.ndarray'>
julia> pybuiltin("type")(cell_centers[1024])
PyObject <class 'list'>
julia> pybuiltin("type")(cell_centers[1024][1])
PyObject <class 'numpy.int64'>

1:1023 indices are converted properly, but 1024:end is not. Nothing is different when loading in python. Given the closeness to a power of 2, I suspect something is going on in PyCall...?

Edit: clarified code

tbenst avatar Apr 10 '21 21:04 tbenst

Impossible to reproduce since you don't provide the file…

stevengj avatar Apr 10 '21 21:04 stevengj

@stevengj I did provide the file, see the link in my post--is the link not working for you?

tbenst avatar Apr 10 '21 23:04 tbenst