当我按照这篇博客文章中所述尝试将csv文件导入Julia DataFrame时,得到了意外的结果。
DataFrame()
把每个CSV.Row放入一个单元格而不是每个字段。由于CSV.Row对象是正确的,因此CSV.jl似乎不是问题。有人看到我漏掉了什么吗?
example.csv
col1,col2,col3
1,2,3
2,3,5
0,1,1
using CSV
using DataFrames
DataFrame(CSV.File("example.csv"))
结果
x1 | x2 | x3 |
---|---|---|
CSV.Row:(col1 = 1,col2 = 2,col3 = 3) | CSV.Row:(col1 = 2,col2 = 3,col3 = 5) | CSV.Row:(col1 = 0,col2 = 1,col3 = 1) |
期望结果
col1 | col2 | col3 |
---|---|---|
1 | 2 | 3 |
2 | 3 | 5 |
0 | 1 | 1 |
编辑
我使用的版本是:
CSV v0.8.3
DataFrames v0.13.1