Numpy r_ / c_ / ix_ issues
- Lingua principale
- Julia
- Stelle
- 1.5k
- Fork
- 186
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The handy numpy convenience "methods" `r_` / `c_` / `ix_` (using bracket syntax) don't work as expected:
```
julia> using PyCall; @pyimport numpy as np
julia> np.r_[1, 3, 5]
3-element Array{Int32,1}:
0
2
4
```
This should return a numpy array with `[1, 3, 5]` as elements (see bottom for Python example)
Also, the following typical `r_` usage gives an error:
```
julia> np.r_[1:3]
ERROR: MethodError: no method matching getindex(::PyObject, ::UnitRange{Int64})
Closest candidates are:
getindex(::PyObject, ::T) where T<:Union{AbstractString, Symbol} at C:\Users\joerg\.julia\packages\PyCall\BcTLp\src\PyCall.jl:337
getindex(::PyObject, ::Integer) at deprecated.jl:70
getindex(::PyObject, ::Integer, ::Integer) at deprecated.jl:70
...
Stacktrace:
[1] top-level scope at REPL[35]:1
```
Version information:
```
julia> using Pkg; Pkg.installed()["PyCall"]
v"1.92.1"
julia> using PyCall; @pyimport numpy as np
julia> np.__version__
"1.19.1"
julia> versioninfo()
Julia Version 1.5.2
Commit 539f3ce943 (2020-09-23 23:17 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
```
Same in Python:
```
In [3]: np.r_[1, 3, 5]
Out[3]: array([1, 3, 5], dtype=int32)
In [4]: np.r_[1:3]
Out[4]: array([1, 2])
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Reproduce the bracket-syntax cases for NumPy r_, c_, and ix_ through PyCall, then inspect the PyObject getindex methods referenced at PyCall.jl:337. Compare the Julia results with the supplied Python examples; done means these expressions return the expected NumPy arrays and range indexing no longer raises MethodError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- julia, numpy
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100