我正在尝试将KDB表拉到python数据框架中。表创建成功,所有的float列都是可见的,但是symbol列是空的。
我正在使用:
with qconnection.QConnection(host = 'XXXX', port = 5001, pandas = True) as q:
df = q.sync('table')
Meta在这个表中显示字符串列的类型是's'。表型为98h。我正在使用python 3.7.
有人遇到过这种情况吗?
我同意Terry的观点,这可能是使用python 3.7和qpython的一个问题。该项目已经处于维护模式一段时间了,在他们的github页面上发现了许多问题https://github.com/exxeleron/qPython
你可以试试这个,看看返回什么?它看起来在python 3.6上运行良好
#open a q session with 'q -p 5000' on localhost
from qpython import qconnection
import pandas as pd
import sys
q = qconnection.QConnection(host = 'localhost', port = 5000, pandas = True)
q.open()
df = q.sendSync('flip `nums`syms`strings!(1 2;`hello`world;("hello";"world"))')
print(df)
print(df.dtypes)
print(df.meta)
print(sys.version)
#the return using python 3.6, kdb 4.0 and qpython from anaconda
nums syms strings
0 1 b'hello' b'hello'
1 2 b'world' b'world'
nums int64
syms object
strings object
dtype: object
metadata(qtype=98, nums=7, syms=11, strings=0)
3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 23:10:56)
[GCC 7.3.0]