I have two data frames namely shares and Log_Returns. I want to multiply first digit of shares with 1st column of Log_Returns. 2nd digit of shares with 2nd column and so on.
I have tried for loop but getting no output and I have got error too.
I have tried this code but no output was there
shares
Out[34]:
0
0 -10.466597
1 92.589647
2 17.876951
Log_Return
Out[35]:
UBL WAHN SCL
Date
2018-12-26 -0.016651 0.000000 0.000000
2018-12-27 -0.022567 -0.014917 0.045282
2018-12-28 -0.034484 0.000000 0.000000
2018-12-31 -0.044806 0.000000 -0.048742
i=0
for j in range(Log_Return.shape[1]):
#j chooses the column of Log data frame
#shape[1] gives number of columns
for k in range(len(Log_Return)):
# k chooses the rows one by one of jth column
shares.iloc[i,0]*Log_Return.iloc[j,k]
#you can multiply and even store the values or do any operations you want
i+=1
#i determines the row of shares data frame
but I get this error
File "<ipython-input-36-ea1f8caa95e5>", line 2
for j in range(Log_Return.shape[1]):
^
IndentationError: unexpected indent