Reputation: 19466
I have a dictionary of the form:
2021.05.03| 0.2466805
2021.05.04| 0.2602927
2021.05.05| 0.2593721
2021.05.06| 0.2605107
2021.05.07| 0.2598938
2021.05.10| 0.266119
2021.05.11| 0.2655128
2021.05.12| 0.2709233
I'm trying to turn it into a table, but I'm struggling.
I think it should be something like:
flip `date`value!myDict
What am I doing wrong?
Upvotes: 0
Views: 1391
Reputation: 3179
Here's one way to do it.
q)([]date:key dict;val:get dict)
date val
---------------------
2021.05.03 0.8866384
2021.05.04 0.0610109
2021.05.05 0.7806546
2021.05.06 0.501583
2021.05.07 0.04288341
2021.05.08 0.4100573
2021.05.09 0.1418907
2021.05.10 0.2533241
You may run into issues using value
for a column name as it is a kdb+ key word.
q)([]date:key dict;value:get dict)
'assign
[0] ([]date:key dict;value:get dict)
^
Upvotes: 3