KDB convert dictionary with multiple values into a table

51 Views Asked by At

I have a dictionary where each key has two values. I want to be able to convert it into a table

tickType            | minDate    maxDate   
--------------------| ---------------------
tickType1           | 2020.08.19 2024.02.26
tickType2           | 2021.05.26 2024.03.02
tickType3           | 2020.08.19 2024.02.26
tickType4           | 2016.06.14 2024.02.27
tickType5           | 2024.02.26 2024.02.26
tickType6           | 2021.08.25 2024.03.01
tickType7           | 2016.06.14 2024.03.01
tickType            | 0W         -0W       

I want to convert it to a table with cols tickType, minDate and maxDate. A simple flip doesn't work as we have multiple values per key here. Raze undoes the structure.

The query that gave me a dictionary is:

select minDate: min date; maxDate:max date by tickType from table

Is there any other way to get the same output in table format?

Thanks

1

There are 1 best solutions below

0
ac26 On BEST ANSWER

Your result is a keyed table (which is a dictionary), if you want to unkey the result you can use:

0!select minDate: min date; maxDate:max date by tickType from table

This will return the above as a simple table.

https://code.kx.com/q/ref/enkey/