-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compatibility with DataFrames mini-language #4
Comments
Can you show an MWE? |
Welp, perhaps it isn't about Setup: julia> using DataFrames, Chain, MissingsAsFalse
julia> df = DataFrame(x=rand(4),inds = [true, false, true, missing])
4×2 DataFrame
Row │ x inds
│ Float64 Bool?
─────┼────────────────────
1 │ 0.392307 true
2 │ 0.20751 false
3 │ 0.940361 true
4 │ 0.0766065 missing The actual problem: julia> @mfalse filter("inds" => ==(true),df)
ERROR: TypeError: non-boolean (Missing) used in boolean context
...
julia> @mfalse df.inds.==true
4-element BitVector:
1
0
1
0
# I guess this works!?
julia> @mfalse filter(r -> r.inds==true,df)
2×2 DataFrame
Row │ x inds
│ Float64 Bool?
─────┼─────────────────
1 │ 0.392307 true
2 │ 0.940361 true What I want to actually do (which doesn't work) # option 1 (preferred!)
@chain df begin
@mfalse filter("inds" => ==(true),_)
end
# option 2
@mfalse @chain df begin
filter("inds" => ==(true),_)
end |
Yes clearly now this is definitely about julia> @chain df begin
@mfalse filter(r-> r.inds ==(true),_)
end
2×2 DataFrame
Row │ x inds
│ Float64 Bool?
─────┼─────────────────
1 │ 0.392307 true
2 │ 0.940361 true |
The problem is with |
gonna be a few days, it's the end of the semester you know! I'm also quite unskilled in macro wizardry but perhaps that won't be necessary for review |
I use
@chain
from Chain.jl quite a bit, but it doesn't seem like@mfalse
plays nicely with it. Do you know if it might be possible to get them to work well together?The text was updated successfully, but these errors were encountered: