using .Q.dpft function to resave table

筅森魡賤 提交于 2020-12-15 03:54:43

问题


I am trying to load the data for each date and then sort the sym column and apply the parted attribute. But I don’t know how to use the .Q.dpft function to save to the same table?

There is a trade table in hdb. Here is my function:

\l dbdir;
test:{
    trade:select from trade where date = x;
    trade:`sym xasc trade;
    .Q.dpft[dbdir;x;`sym;`trade]}each date;

Doesn’t seem to be working though. The error is ``trade`


回答1:


I think you need to pass the table trade & dbdir as arguments to your function since you're referencing them inside the function.

test:{[dbdir;table;x]
  trade:select from table where date = x;
  .Q.dpft[dbdir;x;`sym;table]}[dbdir;`trade]each date

Also perhaps worth noting that .Q.dpft will take care of sorting the sym column for you, so no need to sort it separately.



来源:https://stackoverflow.com/questions/65044905/using-q-dpft-function-to-resave-table

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!