Nested Dict can't figure out how to traverse the structure

I am trying to populate a dash table and think the issue is that I don’t know how to traverse a nested dict properly. I have a Dict

data_flow = 
       Dict{String, Any}("AMZN" => Dict{String, Any}("hv10" => "45.99", "price" => "122.16", "iv_%" => "83.4", "hv20" => "52.14", "iv" => "40.64", "hv5" => "41.21", "prc_%" => "7.51"), "VZ" => Dict{String, Any}("hv10" => "13.87", "price" => "51.27", "iv_%" => "65.61", "hv20" => "12.71", "iv" => "17.62", "hv5" => "10.32", "prc_%" => "19.37"), "C" => Dict{String, Any}("hv10" => "21.26", "price" => "51.78", "iv_%" => "72.73", "hv20" => "42.75", "iv" => "31.75", "hv5" => "20.79", "prc_%" => "11.86"), "IEX" => Dict{String, Any}("hv10" => "19.16", "price" => "195.55", "iv_%" => "70.36", "hv20" => "24.97", "iv" => "27.62", "hv5" => "18.77"))

so to get my column headings for dash I need to isolate out

               HV_10  PRICE    IV_%  hv20  iv  hv5  prc_%

but I can’t figure out how to do it.

I can get the rows

keys(data_flow)

julia> keys(data_flow)
KeySet for a Dict{String, Any} with 4 entries. Keys:
  "AMZN"
  "VZ"
  "C"
  "IEX"

and the values for the table

values(data_flow)

ValueIterator for a Dict{String, Any} with 4 entries. Values:
  Dict{String, Any}("hv10" => "45.99", "price" => "122.16", "iv_%" => "83.4", "hv20" => "52.14", "iv" => "40.64", "hv5" => "41.21", "prc_%" => "7.51")
  Dict{String, Any}("hv10" => "13.87", "price" => "51.27", "iv_%" => "65.61", "hv20" => "12.71", "iv" => "17.62", "hv5" => "10.32", "prc_%" => "19.37")
  Dict{String, Any}("hv10" => "21.26", "price" => "51.78", "iv_%" => "72.73", "hv20" => "42.75", "iv" => "31.75", "hv5" => "20.79", "prc_%" => "11.86")
  Dict{String, Any}("hv10" => "19.16", "price" => "195.55", "iv_%" => "70.36", "hv20" => "24.97", "iv" => "27.62", "hv5" => "18.77")

can someone help me isolate out the column headings in this Dict of dicts.

I’m trying to get this into dash

             HV_10  PRICE    IV_%  hv20  iv  hv5  prc_%
AMZN  45.99   122.16 83.4  52.14 40.64 41.21  7.51
VZ        13.87 51.27  65.61 12.71 17.62 10.32  19.37
C          21.26 51.78 72.73 42.75 31.75 20.79 11.86
IEX      19.16 195.55 70.36 24.97 27.62 18.77

thank you

I’m not sure I understand the problem but does this help in any way?

julia> collect(keys(data_flow["VZ"]))
7-element Vector{String}:
 "hv10"
 "price"
 "iv_%"
 "hv20"
 "iv"
 "hv5"
 "prc_%"
1 Like

Hi there

thanks for looking at this for me. That’s spot on but can I just get the first entry in the dict as all I want is the string vector. “VZ” might not be there so I can’t hard code it.

Sure.

julia> collect(keys(first(values(data_flow))))
7-element Vector{String}:
 "hv10"
 "price"
 "iv_%"
 "hv20"
 "iv"
 "hv5"
 "prc_%"
2 Likes

at some point I will have a brain fitted that will work. In my defense…
actually there is no defense I should be able to figure this stuff out.
thank you so much for the assist.