using CSV: read
In_vec = read(in_vec_file,header=false);
In_vec = In_vec[1] #turn into usable Julia vector
They would return me an Array{Float64,1} of the size of my file. Now, after doing no changes, I get this error “ERROR: ArgumentError: provide a valid sink argument, like `using DataFrames; CSV.read(source, DataFrame)”
Did the functionality recently change? What is the easiest way to collect my ‘read’ as an Array? I know I can use DataFrames and Table.matrix to try to solve this, but I want to first understand the problem and second try to solve it without using more additional packages.
You should be able to do read(in_vec_file, DataFrame, header=false) to get the previous behavior back. Apparently this was changed to avoid having DataFrames as a dependency in CSV.jl.
Thanks @jonathanBieler and @pdeffebach for the inputs. Using DataFrame (which should have been 1:1 with my initial solution) requires changing In_vec[1] to In_vec[!,1] which is fine, but requires “using DataFrames”.
The solution with NamedTuple gives the exact behavior I had before, where I need to do In_vec = In_vec[1] to get a usable vector.
I tried In_vec = read(in_vec_file, collect, header=false), which is a bit frustrating because it’s almost a one-liner. It outputs a 1-element Array{Any,1} similar to the NamedTuple method, requiring the second line to work.
I’m satisfied with this solution because, currently, I only have 1 data point per line. If I had multiple columns to be loaded at once (like a f(x,y) function dump), I think the NamedTuple method would give me a workable variable as well.
Only an ‘off-topic’ question remains: why doesn’t the official documentation have a simple entry on CSV.read? Is it really deprecated and not intended for future use?