'Change the data type of a column of an in-memory table with DolphinDB
For the in-memory table t, I'd like to change the data type of column sym to SYMBOL.
sym = `C`MS`MS`MS`IBM`IBM`C`C`C
price= 49.6 29.46 29.52 30.02 174.97 175.23 50.76 50.32 51.29
qty = 2200 1900 2100 3200 6800 5400 1300 2500 8800
timestamp = [09:34:07,09:36:42,09:36:51,09:36:59,09:32:47,09:35:26,09:34:16,09:34:26,09:38:12]
t = table(timestamp, sym, qty, price)
schema(t).colDefs;
Any suggestions?
Solution 1:[1]
Use DolphinDB replaceColumn!
to change the data type:
syms = symbol(exec sym from t)
replaceColumn!(t, `sym, syms);
schema(t).colDefs;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | dbaa9948 |