Reputation: 469
Here is what my tabular data file looks like
P(days) growth
0 0.67150E+01 -0.11654E-02
1 0.47166E+01 -0.15529E-02
2 0.35861E+01 -0.12327E+00
3 0.28754E+01 -0.30987E+00
4 0.23721E+01 -0.48377E+00
5 0.20062E+01 -0.63666E+00
6 0.17097E+01 -0.17122E+01
7 0.16867E+01 -0.86038E+00
8 0.14523E+01 -0.55203E+00
9 0.12864E+01 -0.37704E+00
I am attempting to read this into a data frame. I tried this:
LINAData = DataFrame(CSV.File(LINAFile, skipto = 2, header = 1, delim=' ', ignorerepeated=true))
But as you can see:
│ Row │ P(days) │ growth │
│ │ Int64? │ Float64 │
├─────┼─────────┼─────────┤
│ 1 │ 0 │ 6.715 │
│ 2 │ missing │ 1.0 │
│ 3 │ missing │ 2.0 │
│ 4 │ missing │ 3.0 │
│ 5 │ missing │ 4.0 │
│ 6 │ missing │ 5.0 │
│ 7 │ missing │ 6.0 │
│ 8 │ missing │ 7.0 │
│ 9 │ missing │ 8.0 │
│ 10 │ missing │ 9.0 │
Is there an issue with how I am delimiting?
Upvotes: 1
Views: 16
Reputation: 69829
Your header is missing column name for the first column, so you have to supply it manually:
julia> LINAData = CSV.read(LINAFile, DataFrame, skipto = 2, header = ["","P(days)", "growth"], delim=' ', ignorerepeated=true)
10×3 DataFrame
│ Row │ │ P(days) │ growth │
│ │ Int64 │ Float64 │ Float64 │
├─────┼───────┼─────────┼────────────┤
│ 1 │ 0 │ 6.715 │ -0.0011654 │
│ 2 │ 1 │ 4.7166 │ -0.0015529 │
│ 3 │ 2 │ 3.5861 │ -0.12327 │
│ 4 │ 3 │ 2.8754 │ -0.30987 │
│ 5 │ 4 │ 2.3721 │ -0.48377 │
│ 6 │ 5 │ 2.0062 │ -0.63666 │
│ 7 │ 6 │ 1.7097 │ -1.7122 │
│ 8 │ 7 │ 1.6867 │ -0.86038 │
│ 9 │ 8 │ 1.4523 │ -0.55203 │
│ 10 │ 9 │ 1.2864 │ -0.37704 │
Upvotes: 1