在 PyQ 中,我可以创建一个字典并用翻转来转置它以获得一个表格......
q.set(':alpha', q('!', ["Name", "Ask", "Bid", "Time"], ()).flip)
但是,正如预期的那样,当我在 q 中加载它并检索元数据时,它会将所有列的 char 类型显示为符号......
>>> q.get(':alpha').show()
Name Ask Bid Time
---------------------------------------------------------------
"BTC" "16351.0" "16350.0" "2017-12-12T17:32:33.09"
"ETH" "589.89999993" "585.25" "2017-12-12T17:32:32.697"
"LTC" "297.0" "296.29570358" "2017-12-12T17:32:32.353"
"BTC" "16355.0" "16351.0" "2017-12-12T17:32:44.777"
"ETH" "589.89999993" "585.25" "2017-12-12T17:32:42.15"
"LTC" "297.99940398" "296.29570359" "2017-12-12T17:32:44.433"
"BTC" "16359.99999998" "16350.0" "2017-12-12T17:32:53.713"
"ETH" "589.89999993" "585.2500001" "2017-12-12T17:32:53.197"
"LTC" "297.99940398" "295.0" "2017-12-12T17:32:51.37"
"BTC" "16355.0" "16350.0" "2017-12-12T17:33:02.433"
"ETH" "585.2500001" "585.25" "2017-12-12T17:33:03.497"
"LTC" "297.99940397" "295.0" "2017-12-12T17:33:01.463"
>>> q()
q)\l alpha
`alpha
q)meta alpha
c | t f a
----| -----
Name| s
Ask | s
Bid | s
Time| s
q)
我相信这是'type
在我执行以下查询时导致控制台抛出错误的原因......
q)select Name, max Ask, max Bid, Time from alpha
'type
q)select max Ask, max Bid, Time by Name from alpha
'type
q)select from alpha where Bid=(max;Bid) fby Name
'type
q)select from alpha where Name=`BTC
Name Ask Bid Time
-----------------
我知道在 q 我可以发出以下命令来实现这一点......
q)alpha:([]Name:`symbol$(); Ask:`float$(); Bid:`float$(); Time:`datetime$())
q)meta alpha
c | t f a
----| -----
Name| s
Ask | f
Bid | f
Time| z
q)
在 PyQ 中为每一列定义 char 类型的正确语法是什么?