JuliaData / CategoricalArrays.jl

Arrays for working with categorical data (both nominal and ordinal)
Other
125 stars 33 forks source link

Make last interval closed in `cut` #373

Open nalimilan opened 3 years ago

nalimilan commented 3 years ago

As discussed at https://github.com/JuliaData/CategoricalArrays.jl/pull/372.

bkamins commented 3 years ago

This is useful as e.g. would be naturally expected to work:

julia> x = rand(10)
10-element Vector{Float64}:
 0.2366632129795181
 0.04511113706323866
 0.8084793399073631
 0.2907765029064078
 0.5881736593087084
 0.41586589602258317
 0.6896384814928804
 0.028969731494246087
 0.9564963314531147
 0.922898163022281

julia> cut(x, quantile(x, [0, 0.5, 1]))
ERROR: ArgumentError: value 0.9564963314531147 (at index 9) does not fall inside the breaks: adapt them manually, or pass extend=true or extend=missing