JuliaPy / JuliaPy/PyCall.jl

keep python nested list/array structure

Abierto
#142 8 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
1.5k
Forks
186
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I was wondering is there any way to retain structure of python nested lists.

In Python - a nested list/array is defined:
e = [[1,2,3],[9,8,[3,2,1]]]

The standard PyCall import output in Julia looks like this:
2x3 Array{Any,2}:
1 2 3
9 8 Any[3,2,1]

Often conversion to multidimensional arrays is very convenient but sometimes I need a bit more explicit control, especially when I want to keep things in order. I'm looking basically for a 1:1 representation:

[1,2,3],[9,8,Any[3,2,1]]

Is there any way I can instruct Julia/PyCall not to do the conversion into multidimensional arrays?
So far I can prevent it by sticking to pyobject type, but then I'm not sure what is the right PyCall's conversion function.

@pyimport mymodule
c = [] # which initilalzes 1-dim Array
PyCall.py2array(c,mymodule.pymember("e"))

Thanks

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start with PyCall.py2array and the @pyimport usage shown in the issue, then inspect how nested Python lists are converted into Julia arrays. Define the expected 1:1 nested-list representation and verify whether the existing conversion entry point can preserve it without forcing multidimensional array conversion.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
julia, python
Área
tooling
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.