Ah yes I see now.
This is is a commonly requested feature in DataFrames. There is no way to index columns for an easy lookup like that.
You can make a GroupedDataFrame
grouping on [:a, :b, :c]
and then index like
gd[(a = 1, b = 2, c = 3)]
This will be fast since a GroupedDataFrame
creates a hash for lookup just like a Dict
.
However this will return a SubDataFrame
, which is itself not the nicest object.
I would do the following
julia> gd = groupby(df_fraction, [:a, :b, :c]);
julia> function get_fraction(gd, ;a = nothing, b = nothing, c = nothing)
only(gd[(;a, b, c)]).fraction
end
get_fraction (generic function with 1 method)
julia> get_fraction(gd; a = 1, b = 2, c = 3)
0.018