Another solution that hasn’t been mentioned yet is to use ===
instead of ==
for comparisons.
julia> 5 == missing
missing
julia> 5 === missing
false
Another solution that hasn’t been mentioned yet is to use ===
instead of ==
for comparisons.
julia> 5 == missing
missing
julia> 5 === missing
false
There are a lot of answers in this thread already that tell you how to do it, e.g.:
julia> df[coalesce.(df.a .!= 5, true), :]
4×2 DataFrame
Row │ a b
│ Int64? Int64
─────┼────────────────
1 │ 3 1
2 │ 6 3
3 │ 0 4
4 │ missing 5
or
julia> df[.!isequal.(df.a, 5), :]
4×2 DataFrame
Row │ a b
│ Int64? Int64
─────┼────────────────
1 │ 3 1
2 │ 6 3
3 │ 0 4
4 │ missing 5
OP, there is also the macro flag @passmissing
in DataFramesMeta.jl which will help you work with missings
, but it will not solve your exact problem in this thread.
FWIW, using findall()
seems to be more performant here:
df[findall(!isequal(5), df.a), :]