Dictionaries · Converting Dictionaries to Tables · Practice Question
Column Dictionary
Question
What is a column dictionary?
Demonstrate how a column dictionary can be converted into a table using flip.
Solution
d:`a`b!(1 2 3;4 5 6)
flip dResult:
a b
---
1 4
2 5
3 6Alternative Solution
A dictionary whose value lists have different lengths is not a column dictionary and cannot be flipped:
dict:`a`b`c!(1 2 3;4 5 6;1 2)
flip dict'lengthExplanation
d's two values both have length 3, so flip transposes them into a 3-row table with a and b as columns. In dict, the columns have lengths 3 3 2 — since flip requires every column to be the same length, it fails with 'length.