Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix categorical for views #547

Closed
bkamins opened this issue Dec 12, 2019 · 3 comments
Closed

fix categorical for views #547

bkamins opened this issue Dec 12, 2019 · 3 comments

Comments

@bkamins
Copy link
Member

bkamins commented Dec 12, 2019

The problem is:

julia> c = categorical([1,2,3], ordered=true)
3-element CategoricalArray{Int64,1,UInt32}:
 1
 2
 3

julia> c
3-element CategoricalArray{Int64,1,UInt32}:
 1
 2
 3

julia> isordered(c)
true

julia> cv = view(c, :)
3-element view(::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}, :) with eltype CategoricalValue{Int64,UInt32}:
 1
 2
 3

julia> isordered(cv)
true

julia> isordered(categorical(cv))
false

The core of the issue is how _isordered function is implemented (as it is not extensible now unfortunately). Probably a temporary fix is to define _isordered for SubArrays.

@nalimilan
Copy link
Member

Did you mean to file this in CategoricalArrays? But yes, I think we can define _isordered to call isordered for any AbstractArray{<:CategoricalValue} which implements that function -- maybe falling back to checking whether each entry is ordered.

@bkamins
Copy link
Member Author

bkamins commented Dec 12, 2019

Yes in CategoricalArrays.jl (I am in parallel looking at CategoricalArrays.jl, CSV.jl and DataFrames.jl so I have mixed this up - sorry for this). I am moving the issue there

@bkamins bkamins closed this as completed Dec 12, 2019
@nalimilan
Copy link
Member

You know we can transfer issues know? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants