Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding levels to ordered categorical array #141

Open
bkamins opened this issue Apr 21, 2018 · 1 comment
Open

Adding levels to ordered categorical array #141

bkamins opened this issue Apr 21, 2018 · 1 comment

Comments

@bkamins
Copy link
Member

bkamins commented Apr 21, 2018

I find the following behavior inconsistent. Is it on purpose?

julia> using CategoricalArrays

julia> x = categorical([1,2,3], ordered=true)
3-element CategoricalArrays.CategoricalArray{Int64,1,UInt32}:
 1
 2
 3

julia> x[3] = 10
ERROR: cannot add new level 10 since ordered pools cannot be extended implicitly. Use the levels! function to set new levels, or the ordered! function to mark the pool as unordered.

julia> recode(x, 3=>10)
3-element CategoricalArrays.CategoricalArray{Int64,1,UInt32}:
 1
 2
 10
@nalimilan
Copy link
Member

That's an oversight, the optimized recode method needs an additional check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants