JuliaPy / JuliaPy/PyCall.jl

Using a CategoricalArray in PyCall results in a <PyCall.jlwrap `obj`> object

Aperta
#789 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
1.5k
Fork
186
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi there.
I am the maintainer of [OdsIO.jl](https://github.com/sylvaticus/OdsIO.jl), a package to export matrices and dataframes to the OpenDocument Spreadsheet format, using `ezodf`, a Python module.

The problem is that with categorical arrays (now used also in `DataFrames`) the object is exported, e.g. as `` instead that just `A`.

I don't know if this can be resolved upstream here or in the `CategoricalArray` package.

For reference, [the code I am using](https://github.com/sylvaticus/OdsIO.jl/blob/master/src/OdsIO.jl) is:

```
if ismissing(v[r,c]) || v[r,c]==nothing
emptyCell = ezodf.Cell()
dcell = get(sheet,(r2-1,c2-1))
dcell = emptyCell
else
dcell = get(sheet,(r2-1,c2-1))
dcell.set_value(v[r,c]) # --> here I (may) pass to PyCall a categorical object
end
```

You can reproduce this problem with:

```
using OdsIO, CategoricalArrays
cat = CategoricalArray([`A`,`B`,`C`], ordered=true)
val = [1,2,3]
m = [cat val]
ods_write("test",Dict(("m",1,1)=>m))
```

Crosslink to the same issue in CategoricalArrays: https://github.com/JuliaData/CategoricalArrays.jl/issues/277

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.