This is something I have:
list1_ = [("1","a","a1"),("1","b","b1"),("1","c","c"),("2","a","a2")]
df1 = pd.DataFrame(list1_,columns = ["user","col1","col2"])
list2_ = [("1","b","b2"),("1","a","a2"),("2","a","a3"),("1","c","c2")]
df2 = pd.DataFrame(list2_,columns = ["user","col1","col3"])
What I am trying to do is is for (user,col1) in df2 match the pair with df1 and add col3 in df1... basically make df1: (user, col1,col2,col3) for the same cell values. The end result should look like this:
list3_ = [("1","a","a1","a2"),("1","b","b1","b2"),("1","c","c","c2"),
("2","a","a2","a3")]
df3 = pd.DataFrame(list3_,columns = ["user","col1","col2","col3"])
Please note: I read df1 from a csv file, and I create df2 using list2_. Therefore, I have some data in the form of list2_ but not in the form of list1_. So, would like to use only df1, list2_ and/or df2.