Initializing DataFrames

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Initializing DataFrames

Julia Stats mailing list
Hi all,

I am using DataFrames to import couple of hundreds of DataFiles, that get merged into one single DataFrame. Currently I am wondering about what would be the best way to initialize that DataFrame, and hope you can help me.

If I do something like

df_all
= DataFrame()

for file in filelist
  df_tmp
=  readtable(file)
 
... do stuff to the df_tmp...
  append
!(df_all,df_tmp)
end

I obviously can't match the column numbers, and everything fails. I wold need to initialize the DataFrame using sth like

df_all
= DataFrame(:col1 = Float64[], :col2 = Int64[])

but I have 26 columns, and from experiment to experiment they tend to change. Useful is setting up a Dictionary, that relates Columns to Eltypes, but there is currently no way of supplying that to the initialization process.

Is there something I missed? Or could easier initialization routines be implemented?

Thank you, Max

--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Initializing DataFrames

Julia Stats mailing list
Solution:

df = DataFrame(column_eltypes::Vector, cnames::Vector, nrows::Integer)

Found in the source code.

--
You received this message because you are subscribed to the Google Groups "julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...