DataAPI.jl icon indicating copy to clipboard operation
DataAPI.jl copied to clipboard

isordered

Open Nosferican opened this issue 4 years ago • 4 comments

This function is defined in CategoricalArrays.jl.

CategoricalArrays.isordered(x::CategoricalValue) = isordered(x.pool)

However, it is quite generic and would be beneficial to have it defined in DataAPI.jl as something like

DataAPI.isordered(::Any) = false
DataAPI.isordered(obj::AbstractVector) = issorted(obj)

Thoughts?

Nosferican avatar Oct 07 '20 07:10 Nosferican

Indeed it would be good to add it and it was discussed. Note that isordered is not the same as issorted.

This is related to https://github.com/JuliaLang/julia/pull/37239 and Ordered trait

bkamins avatar Oct 07 '20 07:10 bkamins

Yes, I'm in favor of this; in Arrow.jl, a dict-encoded column can define whether it's isOrdered as well, so it could leverage this as well.

quinnj avatar Oct 07 '20 18:10 quinnj

This should be added also for DataFrames.jl

bkamins avatar Oct 21 '20 12:10 bkamins

@Nosferican Could you develop the use case do you have in mind? This is important to decide how to define the trait IMO. See https://github.com/JuliaData/DataAPI.jl/pull/26.

nalimilan avatar Oct 25 '20 15:10 nalimilan