Can't retrieve symbols from KDB using QPython

293 Views Asked by At

I am trying to pull a KDB table into a python dataframe. The table is created successfully, all float columns are visable but symbol columns are blank.

I am using:

with qconnection.QConnection(host = 'XXXX', port = 5001, pandas = True) as q:
   df = q.sync('table')

Meta on this table shows the string columns are of type 's'. type of table is 98h. I am using python 3.7.

Anyone has encountered this before?

1

There are 1 best solutions below

1
MurrMack On

I agree with Terry that this might be an issue with using python 3.7 with qpython. The project has been in maintenance mode for a while now with lots of issues noted on their github page https://github.com/exxeleron/qPython

can you please try this and see what is returned? it looks to be working fine on 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]