Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is my conforming dictionary not getting turned into a table?

Let’s say I have a table:

m:([] t: raze 3#'(2021.01.04+til 5); sym:15#`A`B`C; c: til 15)

t          sym c
-----------------
2021.01.04 A   0
2021.01.04 B   1
2021.01.04 C   2
2021.01.05 A   3
2021.01.05 B   4

When I try to pivot it:

exec t!c by sym:sym from m

sym|
---| -----------------------------------------------------------------
A  | 2021.01.04 2021.01.05 2021.01.06 2021.01.07 2021.01.08!0 3 6 9 12
B  | 2021.01.04 2021.01.05 2021.01.06 2021.01.07 2021.01.08!1 4 7 10 13
C  | 2021.01.04 2021.01.05 2021.01.06 2021.01.07 2021.01.08!2 5 8 11 14

I’d expect to get a table back, with columns sym, but I don’t. What am I doing wrong?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

if you’re after a pivot with columns of sym you would want the following:

q)exec sym!c by t:t from m
t         | A  B  C
----------| --------
2021.01.04| 0  1  2
2021.01.05| 3  4  5
2021.01.06| 6  7  8
2021.01.07| 9  10 11
2021.01.08| 12 13 14
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading