nalimilan / FreqTables.jl

Frequency tables in Julia
Other
90 stars 19 forks source link

Error on categorical data #11

Closed mwsohn closed 6 years ago

mwsohn commented 8 years ago

categorical!(df,:race) freqtable(df,:race)

This gives the following error message: Unordered CategoricalValue objects cannot be tested for order; use the ordered! function on the parent array to change this in isless(::CategoricalArrays.CategoricalValue{Int8,UInt8}, ::CategoricalArrays.CategoricalValue{Int8,UInt8}) at C:\Users\ms5vs.julia\v0.5\CategoricalArrays\src\value.jl:69 in isless(::Nullable{CategoricalArrays.CategoricalValue{Int8,UInt8}}, ::Nullable{CategoricalArrays.CategoricalValue{Int8,UInt8}}) at C:\Users\ms5vs.julia\v0.5\NullableArrays\src\operators.jl:156 in sort!(::Array{Nullable{CategoricalArrays.CategoricalValue{Int8,UInt8}},1}, ::Int64, ::Int64, ::Base.Sort.InsertionSortAlg, ::Base.Order.ForwardOrdering) at .\sort.jl:222 in sort!(::Array{Nullable{CategoricalArrays.CategoricalValue{Int8,UInt8}},1}, ::Int64, ::Int64, ::Base.Sort.MergeSortAlg, ::Base.Order.ForwardOrdering, ::Array{Nullable{CategoricalArrays.CategoricalValue{Int8,UInt8}},1}) at .\sort.jl:311 in sort!(::Array{Nullable{CategoricalArrays.CategoricalValue{Int8,UInt8}},1}, ::Base.Sort....

I am using DataFrames with NullableArrays in master.

nalimilan commented 8 years ago

Thanks for the report. Indeed I haven't updated the package to work with CategoricalArray yet. Will fix this soon.

bkamins commented 6 years ago

I guess this is fixed - right?

@nalimilan A related question is why freqtable for CategroricalArray does not have weights and subset keyword arguments. Is it intentional or under development?

nalimilan commented 6 years ago

I guess this is fixed - right?

I think so.

@nalimilan A related question is why freqtable for CategroricalArray does not have weights and subset keyword arguments. Is it intentional or under development?

Right, I realized that during the port too. I guess I didn't have the time to implement them when I wrote the package. PRs would be welcome.