I am trying to speed up the loop, in which consecutive dataframes are joined with the first one with the first column as key. Dataframes are produced by a function my_function. First column is named :REF. Consecutive Dataframes could be shorter that first one, thus I cannot directly assign to DF column, as I would do in pandas.
base_df = my_function(elem1)
for elem in elems[2:end]
tmp = my_function(elem)
base_df = join(base_df, tmp, on=:REF, kind=:left)
end
Is there any way to join list of dataframes into one? Thanks,
PS: DataFrames are of different types: String, Int, Float64.
Upd. So, example DataFrames:
df1 = DataFrame(REF = 1:5, D1=rand(5))
df2 = DataFrame(REF = 1:3, D1=rand(3))
df3 = DataFrame(REF = 1:4, D1=rand(4))
What I looking for it to combine those three (or more) into single DataFrame at once. Note the row count differencies.
Upd2. Sorry, it should have been diffent columns on df1, df2 and df3 (D1, D2 and D3). Here is the correct setup of DFs
df1 = DataFrame(REF = 1:5, D1=rand(5))
df2 = DataFrame(REF = 1:3, D2=rand(3))
df3 = DataFrame(REF = 1:4, D3=rand(4))