I have a trivial problem that I decided to use with loops, but I'm trying to figure out if there is a way by which I will try to quote some of them in order to try to improve performance.
Essentially, I have 2 data frames (DF_A and DF_B), where the rows in DF_B are based on the summation of the corresponding row in DF_A and the row above in DF_B. I have the first row of values in DF_B.
df_a = [
[1,2,3,4]
[5,6,7,8]
[..... more rows]
]
df_b = [
[1,2,3,4]
[ rows of all 0 values here, so dimensions match df_a]
]
What I'm trying to achieve is that the second line in df_b, for example, will be the values of the first line in df_b + the values of the second line in df_a. So in this case:
df_b.loc[2] = [6,8,10,12]
, df_a, , . .