The CategoricalArray constructor and the categorical function from CategoricalArrays.jl seem to be nearly identical in behavior:
julia> using CategoricalArrays
julia> x = CategoricalArray(["a", "b", "c"]; ordered=true, levels=["c", "b", "a"])
3-element CategoricalArray{String,1,UInt32}:
"a"
"b"
"c"
julia> y = categorical(["a", "b", "c"]; ordered=true, levels=["c", "b", "a"])
3-element CategoricalArray{String,1,UInt32}:
"a"
"b"
"c"
julia> x == y
true
Is there any notable difference between CategoricalArray and categorical? If they're basically the same, then what's the reason for including the redundant categorical function?
categorical supports compress keyword argument as opposed to CategoricalArray.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With