JuliaPy / JuliaPy/PyCall.jl

only first 1023 indices are converted

未关闭
#892 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Julia
星标
1.5k
派生
186
PR 合并指标
30 天内没有已合并 PR

描述

I have a file, [`stat.npy`](https://drive.google.com/open?id=1ZpbRwub-KpSnT_BJDGIAW-uh-5QJWKtl).

```julia
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
julia> pybuiltin("type")(cell_centers[1024])
PyObject
julia> pybuiltin("type")(cell_centers[1024][1])
PyObject
```
`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

贡献指南

这个仓库没有索引到贡献指南

调研方向

使用 stat.npy 通过 Julia 和 Python 代码片段复现该行为,然后检查 PyCall 针对索引 1023 和 1024 附近不同的 NumPy 数组值和列表值的转换路径。当受影响的值在整个集合中都能一致转换,并且复现确认结果时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, numpy, python
领域
api
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。