You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would work similarly to @rsubset but it would automatically call only and extract the desired value.
For example:
julia> df =DataFrame(x =1:5, y = ["A","A","B","B","B"], z = (1:5)./10)
5×3 DataFrame
Row │ x y z
│ Int64 String Float64
─────┼────────────────────────
1 │ 1 A 0.12 │ 2 A 0.23 │ 3 B 0.34 │ 4 B 0.45 │ 5 B 0.5
julia> zvalue =@rsubset(df, :x>1, :y=="A").z |> only
0.2
julia> zvalue =@lookup(df, :z, :x>1, :y=="A")
0.2
It could maybe also work without the second argument to return a DataFrameRow.
It was mentioned that this may need to be called rlookup to match rsubset, but I think that is not necessary if the single value method is implemented. (This discussion started in the DataFrames.jl repository: JuliaData/DataFrames.jl#3051 (comment))
Would this function make DataFrames lookups more accessible to newcomers, or is the existing @rsubset functionality good enough?
The text was updated successfully, but these errors were encountered:
That particular syntax isn't actually possible, since @lookup would only apply to the expression inside the brackets.
Moreover, I would definitely want to avoid that kind of exotic syntax. DataFrames.jl doesn't have any data.table style indexing, and I think the initial proposed syntax is good.
It would work similarly to
@rsubset
but it would automatically callonly
and extract the desired value.For example:
It could maybe also work without the second argument to return a
DataFrameRow
.It was mentioned that this may need to be called
rlookup
to matchrsubset
, but I think that is not necessary if the single value method is implemented. (This discussion started in the DataFrames.jl repository: JuliaData/DataFrames.jl#3051 (comment))Would this function make DataFrames lookups more accessible to newcomers, or is the existing
@rsubset
functionality good enough?The text was updated successfully, but these errors were encountered: