DataFramesMeta.jl
DataFramesMeta.jl copied to clipboard
Short-circuiting AND for @subset
Currently, each conditional seems to be evaluated for @subset
, it would be nice (and possibly more efficient?) to use short-circuiting evaluation
julia> df = DataFrame(a = ["xy", "yz", missing, "za"], b=rand(4));
julia> @rsubset(df, !ismissing(:a), !startswith(:a, "x"))
ERROR: MethodError: no method matching startswith(::Missing, ::St
ring)
As @bkamins said on slack, one can currently get this behavior using &&
explicitly:
julia> @rsubset(df, !ismissing(:a) && !startswith(:a, "x"))
2×2 DataFrame
Row │ a b
│ String? Float64
─────┼───────────────────
1 │ yz 0.701172
2 │ za 0.757161