I have a result data frame with only indices to be populated with results that comes through on a row by row operation.
a res1 res2 res3
0 1
1 4
2 0
3 1
4 5
I'm looping through each row with
df.apply(func, axis=1)
which points to another function coming up with results for each row. The results are calculated from other dfs and I basically do a linear combination of several rows depending on the index column a like so:
def func(row):
...
combinedrow = x*df2.iloc[index1]+y*df3.iloc[index2] + etc..
Each of the other dfs have the same results headings. I want to basically insert this row result into each row like this:
a res1 res2 res3
0 1 2 3 4
1 4
2 0
3 1
4 5
it has to be done one row at a time because of the apply() function.
How do i do the partial row merge? Performance is very important, hence i've not inserted each number separately under the columns.