invenia / Impute.jl

Imputation methods for missing data in julia
https://invenia.github.io/Impute.jl/latest/
Other
76 stars 11 forks source link

`declaremissings` doesn't replace values of a different (but convertable) type #127

Closed awadell1 closed 2 years ago

awadell1 commented 2 years ago

MWE

julia> using Impute
julia> using CSV # For FixedWidth Strings
julia> Impute.declaremissings(String31["Unknown", "adaf"]; values=("Unknown"))
2-element Vector{Union{Missing, String31}}:
 "Unknown"
 "adaf"

Desired output:

2-element Vector{Union{Missing, String}}:
 missing
 "adaf"

I think the root cause is apply!(..., ::DeclareMissings only replacing values with matching type. As !(String31 <: String) nothing gets replaced.