Iterating through two separate panda data frames via for loop in python? -


i have 2 panda data frames:

df1    df2 1      5 4      4 3      2 

i want create list such data frames concatenated colon:

1:5, 4:4, 3:2 

help previous question shows can do:

["{}:{}".format(a, a) in df1] 

which makes list 1:1, 4:4, 3:3, how do this:

["{}:{}".format(a, b) a, b in df1, df2]  

to create desired result above?

something this?

df1 = pd.dataframe({"df1":[1,4,3]}) df2 = pd.dataframe({"df2":[5,4,2]})  ["{}:{}".format(a, b) a, b in zip(df1.df1, df2.df2)] ['1:5', '4:4', '3:2'] 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -