Hello community
I use Julia to build JuMP models. What you usually have is indexed parameters that I would like to store in DataFrames and have convenient access when writing models. Think of a DataFrame where you have the first few columns acting as index and each other column as the properties. What data structure do you recommend to keep things organized. So far I had to construct a dictionary out of every column, which is not very clean.
This is my use case
julia> df
3ร3 DataFrame
Row โ Material StdCost LeadTime
โ Symbol Int64 Int64
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ A 10 1
2 โ B 20 2
3 โ C 30 3
In this example I want a convenient way of accessing the StdCost for material C. I figured out that the indexing can be handled by a GroupedDataFrame, but the access is still not pretty
julia> gdf = groupby(df, :Material)
GroupedDataFrame with 3 groups based on key: Material
First Group (1 row): Material = :A
Row โ Material StdCost LeadTime
โ Symbol Int64 Int64
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ A 10 1
โฎ
Last Group (1 row): Material = :C
Row โ Material StdCost LeadTime
โ Symbol Int64 Int64
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ C 30 3
# The Notation I have to make (not pretty)
julia> gdf[(:C,)].StdCost[1]
30
# The Notation I would like to have
julia> gdf[:C].StdCost
30
Any suggestions on how to solve this?
thanks!