It would be a bad idea to return Array{T, 1} in the special case of a file
with a single column. The return type would be dependent upon the csv file
which is a really bad design.
On Sunday, May 11, 2014 8:29:57 PM UTC+2, Ethan Anderes wrote:
>
> Does it make sense to have readcsv return an Arra
Thanks for the response. Still not sure I understand what you mean. readcsv
returns Array{T, 2} where T is determined form the file ... so the type of the
output does change based on the file. Since column vectors are thought of as
1-d arrays in Julia I would have assumed the Julian way to load
vec should have minimal overhead. (Unlike [:], it doesn't make a copy of
the underlying data.)
On Sunday, May 11, 2014 6:00:10 PM UTC-4, Ethan Anderes wrote:
>
> Thanks for the response. Still not sure I understand what you mean.
> readcsv returns Array{T, 2} where T is determined form the file
Yes, when reading data from files, where information about the object is
encoded in the file, "type stability" kinda goes out the window. (We have the
same issue with HDF5, of course.)
So it's not an unreasonable request (although neither is the current
behavior). You might consider giving it a
> a file contains a single column
Isn't a CSV file without commas just a file? In which case, wouldn't
it make more sense to do line-oriented IO?
readlines(csvfile)
On Sun, May 11, 2014 at 10:27 PM, Tim Holy wrote:
> Yes, when reading data from files, where information about the object is
> enc
@Simon and @Jameson: Yep, vec seems preferred to [:]. I just took a look at
readlines and it was a bit clunky (I had to open the file, then readlines gives
me a Array{Union(UTF8String,ASCIIString),1}, then I convert to
Array{Float64,1}, then I guess I should close the file). In the end I was jus
Le dimanche 11 mai 2014 à 21:27 -0500, Tim Holy a écrit :
> Yes, when reading data from files, where information about the object is
> encoded in the file, "type stability" kinda goes out the window. (We have the
> same issue with HDF5, of course.)
But this would mean that functions loading CSV f