Skip to content

Broadcasting methods over CategoricalString has changed #199

Closed
@ablaom

Description

@ablaom

A recent change in CategoricalArrays has broken my code at MLJ. The change seems strange to me and I wonder if it is intentional (I hope not :-)):

Starting with:

using CategoricalArrays
lev(cat_element) = cat_element.pool.levels

julia> v = categorical(["a", "b", "c"])
3-element CategoricalArray{String,1,UInt32}:
 "a"
 "b"
 "c"

julia> lev(first(v))
3-element Array{String,1}:
 "a"
 "b"
 "c"

Under 0.5.2:

julia> V = [v, v, v]
3-element Array{CategoricalArray{String,1,UInt32,String,CategoricalString{UInt32},Union{}},1}:
 ["a", "b", "c"]
 ["a", "b", "c"]
 ["a", "b", "c"]

julia> lev(first.(V)[1])
3-element Array{String,1}:
 "a"
 "b"
 "c"

... which makes sense to me. But now, under 0.5.4, we have:

julia> V = [v, v, v]
3-element Array{CategoricalArray{String,1,UInt32,String,CategoricalString{UInt32},Union{}},1}:
 ["a", "b", "c"]
 ["a", "b", "c"]
 ["a", "b", "c"]

julia> lev(first.(V)[1])
1-element Array{String,1}:
 "a"

... which is causing me problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions