1

How to specify table schema when using function loadText dealing with csv file?

When I loadText from csv file

loadText("/data/myhome/test.csv"),but the result are not what I expected, so How can I specify table schema when I load csv file using function loadText?

ink
  • 519
  • 6
  • 19
pengfei
  • 61
  • 2

1 Answers1

0

Here is an example.

schematable=table(`ID`datetime`qty`price as name,`FLOAT`TIMESTAMP`LONG`DOUBLE as type)
tt=loadText("C:/DolphinDB/Data/t1.txt",,schema)

In the above example, I force the four loaded columns to be float, timestamp, long, and double.

Davis Zhou
  • 353
  • 4
  • 6