如何将表导出为二进制文件?

请先 登录 后评论

1 个回答

Juntao Wang

可以使用writeRecord 函数,示例代码如下:

n = 10000
t = table(rand(1..100, n) as id, rand(100.0, n) as value)
f = file("/hdd/hdd0/jtwang/data/xinfei/test_export.bin", "w")
writeRecord(f, t)

这个函数目前有些限制,对于字符串类型不支持,可以使用API 规避一下,Python API示例代码如下:

binFile = open("D:/Work/test_import.bin", 'wb+')
pickle.dump(contextDF, binFile)
binFile.close()
请先 登录 后评论