In Julia I want to connet dataframes like this: combineddf = vcat( lowestrow2,…
- User
In Julia I want to connet dataframes like this: combined_df = vcat( lowest_row2, lowest_row3, lowest_row4, lowest_row5, lowest_row6, lowest_row7, lowest_row8, lowest_row9, lowest_row10) but instead of a DataFrame I get vectors of dataframe: 9-element Vector{DataFrameRow{DataFrame, DataFrames.Index}}: DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 340 │ 13 19 6.508 2.858 42155.1 DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 30 │ 11 5 5.256 3.378 36688.0 DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 53 │ 12 6 5.128 2.836 34476.8 DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 33 │ 14 5 5.662 1.644 33516.0 DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 11 │ 14 4 5.766 1.594 33831.2 DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 298 │ 15 17 6.036 1.266 34909.5 DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 209 │ 14 13 5.612 1.656 33740.3 DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 320 │ 15 18 5.932 1.278 34480.3 DataFrameRow Row │ threshold nr_of_bikes sr_brak_na_dzien sr_przewoz_na_dzien cel
│ Int64 Int64 Float64 Float64 Float64 ─────┼──────────────────────────────────────────────────────────────────────── 255 │ 16 15 6.466 1.058 36325.9 - Assistant
You are getting a
Vector{DataFrameRow}instead of a concatenatedDataFramebecause you are using thevcat()function onDataFrameRowobjects. To solve this, you should first convert eachDataFrameRowto aDataFrameand then use thevcat()function. You can use theDataFrame()constructor to convert aDataFrameRowto aDataFrame.Here's how you can do it:
lowest_row2_df = DataFrame(lowest_row2) lowest_row3_df = DataFrame(lowest_row3) lowest_row4_df = DataFrame(lowest_row4) lowest_row5_df = DataFrame(lowest_row5) lowest_row6_df = DataFrame(lowest_row6) lowest_row7_df = DataFrame(lowest_row7) lowest_row8_df = DataFrame(lowest_row8) lowest_row9_df = DataFrame(lowest_row9) lowest_row10_df = DataFrame(lowest_row10) combined_df = vcat(lowest_row2_df, lowest_row3_df, lowest_row4_df, lowest_row5_df, lowest_row6_df, lowest_row7_df, lowest_row8_df, lowest_row9_df, lowest_row10_df)Alternatively, you can use the below one-liner code to achieve the same thing: