As outlined in How to remove rows containing missing from DataFrame? the way to get rid of missings in a DataFrame is to use dropmissing
. This works really well and I use it all the time, but it bugs me that I cannot use what would to me be more natural, i.e., skipmissing
. Is there a logical reason I’m missing for why dropmissing
had to be introduced instead of a specialized implementation for skipmissing
for a DataFrame?
skipmissing
has a different indexing rule:
julia> x = [1, 2, missing, 4, 5]
5-element Vector{Union{Missing, Int64}}:
1
2
missing
4
5
julia> y = skipmissing(x)
skipmissing(Union{Missing, Int64}[1, 2, missing, 4, 5])
julia> y[2]
2
julia> y[3]
ERROR: MissingException: the value at index (3,) is missing
julia> y[4]
4
5 Likes
Thanks for the explanation.