I get the matrix by the function pivot, then I transfer it into a table by the function table. I find the table lost the label column. How to save the label column in this table?
The example codes are shown as below:
syms=`600300`600400`600500$SYMBOL
sym=syms[0 0 0 0 0 0 0 1 1 1 1 1 1 1 2 2 2 2 2 2 2]
time=09:40:00+1 30 65 90 130 185 195 10 40 90 140 160 190 200 5 45 80 140 170 190 210
price=172.12 170.32 172.25 172. 175.1 174.85 174.5 36.45 36.15 36.3 35.9 36.5 37.15 36.9 40.1 40.2 40.25 40.15 40.1 40.05 39.95
volume=100 * 10 3 7 8 25 6 10 4 5 1 2 8 6 10 2 2 5 5 4 4 3
t1=table(sym, time, price, volume);
stockprice=pivot(wavg, [t1.price, t1.volume], minute(t1.time), t1.sym)
stockprice.round(2);
I get the data in stockprice
label | 600300 | 600400 | 600500 |
---|---|---|---|
09:40m | 171.7 | 36.28 | 40.15 |
09:41m | 172.41 | 36.3 | 40.25 |
09:42m | 175.1 | 36.38 | 40.13 |
09:43m | 174.63 | 36.99 | 40.01 |
After I transfer it by the function table, the label column is missingļ¼
table(stockprice)
col600300 | col600400 | col600500 |
---|---|---|
171.7046 | 36.2833 | 40.15 |
172.41 | 36.3 | 40.25 |
175.1 | 36.38 | 40.1278 |
174.6312 | 36.9937 | 40.0071 |