Interesting. It's a columnar CSV. Assuming you don't have to deal with non-numeric data or NAs, or worse, different-length columns, I think it'd be about 10 lines of code to read each line, extract the column name, split the numbers into an array, convert to DataArray, then assemble into a DataFrame with the right column names.
In some ways that's a simpler format to read/write than the usual row-based CSV. On Thu, Sep 4, 2014 at 12:45 AM, Jason Knight <[email protected]> wrote: > I usually go straight to the source when looking for things in DataFrames > as the documentation is missing quite a bit of functionality (push!, hcat, > vcat, melt etc..) but in this case as Kevin mentioned: no dice. > > But you can always hack it: > > using DataFrames > > fname = "datat.csv" > data = readcsv(fname,Any) > io = IOBuffer() > writecsv(io,data') > seek(io,0) > > readtable(io,filesize(fname)) > > > On Wednesday, September 3, 2014 10:34:41 PM UTC-5, Leah Hanson wrote: >> >> So, assuming you have a CSV file that looks like this: >> >> ~~~ >> Column One,2,3,4 >> Column Two,2,5,7 >> Column Three,1,9,8 >> ~~~ >> >> But each line has a lot more numbers in it. I would like to read it into >> a DataFrame, where the DataFrame would understand it as: >> >> ~~~ >> Column One, Column Two, Column Three >> 2,2,1 >> 3,5,9 >> 4,7,8 >> ~~~ >> >> Is the best thing just to edit the file first into a normal format, or is >> there some option I can pass into DataFrames to make it understand? (I did >> not see one on the I/O page of the DataFrames docs, but that can be out of >> date sometimes.) >> >> [I realize this is an unusual thing to want. I expect to just edit the >> file to be in the right order, but I wanted to check to see if DataFrames >> already handles this.] >> >> Thanks, >> Leah >> >
