JuliaData / DataAPI.jl

A data-focused namespace for packages to share functions
Other
33 stars 13 forks source link

isordered #23

Open Nosferican opened 4 years ago

Nosferican commented 4 years ago

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?

bkamins commented 4 years ago

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

quinnj commented 4 years ago

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.

bkamins commented 4 years ago

This should be added also for DataFrames.jl

nalimilan commented 4 years ago

@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.