"M-d-y h-m" 这种格式的csv时间数据怎么导入

csv中样本数据如下:

datetime,symbol,price,volume
10/1/2020 9:00,XYZ,10.68,375
10/1/2020 9:00,XYZ,10.9,66
10/1/2020 9:00,XYZ,11.42,103
10/1/2020 9:00,XYZ,12.62,280
10/1/2020 9:00,XYZ,10.73,23
10/1/2020 9:00,XYZ,11.44,299
10/1/2020 9:00,XYZ,12.66,152
10/1/2020 9:00,XYZ,11.04,401
10/1/2020 9:00,XYZ,10.61,392
10/1/2020 9:00,XYZ,11.21,473

我用下面代码读取数据:

schemaTB = extractTextSchema(csvFile)

update schemaTB set type="DATETIME" where name="datetime"

schemaTB[`format]=["M-d-y h:m:s",,,];

t = loadText(csvFile,,schemaTB)

t = loadText(csvFile, , schemaTB) => Invalid temporal format M-d-y h:m:s
请先 登录 后评论

1 个回答

wale


https://gitee.com/dolphindb/Tutorials_CN/blob/master/import_csv.md的第2和4节有说明,代码修改如下:

schemaTB = extractTextSchema(csvFile)
update schemaTB set type="DATETIME" where name="datetime"
schemaTB[`format]=["MM/dd/yyyy HH:mm",,,];
t = loadText(csvFile,,schemaTB)
请先 登录 后评论