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
Post a Comment