【发布时间】:2021-05-05 01:33:37
【问题描述】:
当我尝试将 csv 文件导入到 this blogpost 中描述的 Julia DataFrame 时,我得到了意想不到的结果。
DataFrame() 将每个 CSV.Row 放入一个单元格而不是每个字段。 CSV.jl 似乎不是问题,因为 CSV.Row 对象是正确的。有人看到我在这里缺少什么吗?
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
【问题讨论】: