JuliaPy / JuliaPy/PyCall.jl

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

Open
#789 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.