1

KDB データベースからデータを抽出し、datframe に配置したいと考えています。私のクエリは qpad で問題なく実行されます。問題はありません。Pandas データフレームに書き込むだけです。私のコード:

from qpython import qconnection

# Create the connection and save the handle to a variable
q  = qconnection.QConnection(host = 'wokplpaxvj003', port = 11503, username = 'pelucas', password = 'Dive2600', timeout = 3.0)
try:
    # initialize connection
    q.open()
    print(q)
    print('IPC version: %s. Is connected: %s' % (q.protocol_version, q.is_connected()))

    df = q.sendSync('{select from quote_flat where date within (2019.08.14;2019.08.14), amendment_no = (max;amendment_no)fby quote_id}')

    df.info()

finally:
    q.close()

df.info()レイズで失敗するAttributeError: 'QLambda' object has no attribute 'info'ので、呼び出しは成功していないと思います。

4

1 に答える 1

3

ラムダのみを送信したようですが、そのラムダを実行する指示はありません。2 つのオプション:

  1. ラムダにしないでください
df = q.sendSync('select from quote_flat where date within (2019.08.14;2019.08.14), amendment_no = (max;amendment_no)fby quote_id')
  1. ラムダを実行する
df = q.sendSync('{select from quote_flat where date within (2019.08.14;2019.08.14), amendment_no = (max;amendment_no)fby quote_id}[]')
于 2019-08-23T07:39:35.187 に答える