JuliaPy / JuliaPy/PyCall.jl

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

Offen
#789 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.