IndexedTables
# Let's create some fake data..
param = String["price","price","price","price","waterContent","waterContent"]
item = String["banana","banana","apple","apple","banana", "apple"]
region = Union{String,Missing}["FR","UK","FR","UK",missing,missing]
value2000 = Float64[2.8,2.7,1.1,0.8,0.2,0.7]
value2010 = Float64[3.2,2.9,1.2,0.8,0.2,0.8]
# table constructor..
myTable = table(
(param=param,item=item,region=region2,value00=value2000,value10=value2010)
;
pkey = [:param, :item, :region]
)
# ndsparse construct.. note two separated NamedTuples for keys and values..
mySparseTable = ndsparse(
(param=param,item=item,region=region),
(value00=value2000,value10=value2010)
)
# Query data..
myTable[3]
mySparseTable["price",:,:] # ":" let select all values for the specific dimension
# Edit individual items (only for ndsparse):
mySparseTable["price","banana","FR"] = (value00=2.7, value10=3.2)Last updated