Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looping through two data frames in python

Tags:

python

pandas

I would like to loop through two data frames at the same time

x is where i need the interest data to go in. How do i get the interest data for the variable x?

like image 815
lakshmen Avatar asked Dec 02 '25 13:12

lakshmen


1 Answers

There are same index and columns values, so is possible select second DataFrame by index and columns values from first one by Series.at or Series.loc:

for r in usd_margin_data.index:
    for c in usd_margin_data.columns:
        print (usd_margin_data.at[r, c])
        print (interest_data.at[r, c])  
like image 109
jezrael Avatar answered Dec 05 '25 03:12

jezrael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!