kdb q-将二进制文件读入表

时间:2019-01-18 11:50:52

标签: kdb

我有一个看起来像这样的二进制文件

read0 hsym`$binaryfile

("   I D ^ I D 2    
 ";" 1 0 0 ^ 1 0   
 ";" 2 0 0 ^ 2 0 ...

在python中,我可以像这样将二进制文件读入pandas数据框中

from io import BytesIO
with open(binaryfile, "rb") as f:
    df = pd.read_csv(BytesIO(f.read().decode("UTF-16").encode("UTF-8")), encoding = "utf-8", delimiter="^")

但是我不想直接将此数据帧保存为csv,而是想通过直接从文件中读取将其加载到q表中。

我尝试了0:运算符,方法是先将上面的字符串列表串联起来,然后使用
(types; delimiter[;allowEmbeddedLineReturns]) 0: string


("SS";" ^ ";enlist"|") 0: "|" sv read0 hsym`$binaryfile

但是我遇到类型错误

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

get hsym`$binaryfile

...应该工作。

相关问题