Vcat multiple DataFrames

I have a bunch of DataFrameRow in a Dict that I want to convert to a DataFrame

julia> RSM_df[:RSM_77]
13-element Vector{Any}:
 DataFrameRow
 Row │ datetime             RSM_Date_IV          RSM_Exp_Flux  RSM_Exp_FluxCV  ⋯
     │ DateTime             DateTime             Float64       Float64         ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ 2020-04-20T12:00:00  2020-04-20T12:21:54          1.66             1.2  ⋯
                                                                1 column omitted
 DataFrameRow
 Row │ datetime             RSM_Date_IV          RSM_Exp_Flux  RSM_Exp_FluxCV  ⋯
     │ DateTime             DateTime             Float64       Float64         ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ 2020-05-06T13:00:00  2020-05-06T13:02:05          2.11             1.2  ⋯
                                                                1 column omitted

this works for a few:

julia> vcat(DataFrame(RSM_df[:RSM_77][1]), DataFrame(RSM_df[:RSM_77][2]))
2×5 DataFrame
 Row │ datetime             RSM_Date_IV          RSM_Exp_Flux  RSM_Exp_FluxCV  RSM_Exp_R2 
     │ DateTime             DateTime             Float64       Float64         Float64    
─────┼────────────────────────────────────────────────────────────────────────────────────
   1 │ 2020-04-20T12:00:00  2020-04-20T12:21:54          1.66             1.2      0.9975
   2 │ 2020-05-06T13:00:00  2020-05-06T13:02:05          2.11             1.2      0.9985

and this works to converts all DataFrameRow to DataFrame:

julia> DataFrame.(RSM_df[:RSM_77])
13-element Vector{DataFrame}:
 1×5 DataFrame
 Row │ datetime             RSM_Date_IV          RSM_Exp_Flux  RSM_Exp_FluxCV  ⋯
     │ DateTime             DateTime             Float64       Float64         ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ 2020-04-20T12:00:00  2020-04-20T12:21:54          1.66             1.2  ⋯
                                                                1 column omitted
 1×5 DataFrame
 Row │ datetime             RSM_Date_IV          RSM_Exp_Flux  RSM_Exp_FluxCV  ⋯
     │ DateTime             DateTime             Float64       Float64         ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ 2020-05-06T13:00:00  2020-05-06T13:02:05          2.11             1.2  ⋯
                                                                1 column omitted

However I don’t know how to vcat them all, neither vcat.(DataFrame.(RSM_df[:RSM_77])) nor vcat(DataFrame.(RSM_df[:RSM_77])) works.
how can I do it?

1 Like

I found a solution:

julia> vcat(DataFrame(RSM_df[:RSM_77][:]))
13×5 DataFrame
 Row │ datetime             RSM_Date_IV          RSM_Exp_Flux  RSM_Exp_FluxCV  RSM_Exp_R2 
     │ DateTime             DateTime             Float64       Float64         Float64    
─────┼────────────────────────────────────────────────────────────────────────────────────
   1 │ 2020-04-20T12:00:00  2020-04-20T12:21:54       1.66            1.2        0.9975
   2 │ 2020-05-06T13:00:00  2020-05-06T13:02:05       2.11            1.2        0.9985
   3 │ 2020-05-18T11:30:00  2020-05-18T11:59:10       2.83            1.4        0.9929
   4 │ 2020-06-01T12:00:00  2020-06-01T12:13:34       3.71            1.1        0.9994
   5 │ 2020-06-08T11:00:00  2020-06-08T11:14:21       1.63            1.3        0.9962
   6 │ 2020-06-23T14:00:00  2020-06-23T14:00:53       8.67998         1.19479    0.998992
   7 │ 2020-07-08T13:30:00  2020-07-08T13:57:12       5.98454         1.23536    0.998593
   8 │ 2020-07-23T12:00:00  2020-07-23T12:17:58       5.59169         1.32733    0.997658
   9 │ 2020-08-11T13:00:00  2020-08-11T13:23:46       4.44405         1.33099    0.997645
  10 │ 2020-08-26T11:30:00  2020-08-26T11:41:54       3.00228         1.39432    0.99592
  11 │ 2020-09-10T12:30:00  2020-09-10T12:31:07       6.0159          1.16724    0.99919
  12 │ 2020-09-22T12:00:00  2020-09-22T12:11:10       3.19239         3.77807    0.951351
  13 │ 2020-10-13T12:30:00  2020-10-13T12:36:23       3.0282          1.64201    0.972854
1 Like