Tabulated data are treated as rows of strings by CSV.File

I am trying to get this table of data representing the SLy equation of state for a neutron star. CSV.File(HTTP.get("http://www.ioffe.ru/astro/NSG/NSEOS/sly4.dat").body) loads the data as strings of a single column instead of four columns of numbers. How to get the expected results? The problem remains the same even if the load the data file from the local directory.

The first few rows of your file isn’t data.

See skipto in the CSV.File docs (CSV.jl Documentation · CSV.jl)

4 Likes
using DataFrames
using HTTP
using CSV

df=DataFrame(CSV.File(HTTP.get("http://www.ioffe.ru/astro/NSG/NSEOS/sly4.dat").body;
    header=false,skipto=7,delim=" ",ignorerepeated=true))

Or without DataFrames of course.

1 Like