Append df based on regex match with another data frame

Viewed 18

I have two dataframes and would like to append values from df2 to df1 based on a regex match:

df1
index  Name
1      Miami Project Cure Paralysis, Miami
2      Dept Orthoped Surg, Baudour, Belgium


df2
index   cities  lat lng
1       Miami   35.8  139.19
2       Boudour -12.5 -45.5

So the resulting data frame should basically look like this :

 df1
index  cities  lat log      Name
1      Miami   35.8  139.19 Miami Project Cure Paralysis, Miami.  
2      Boudour -12.5 -45.5  Dept Orthoped Surg, Baudour, Belgium

I have managed to use str.findall to match df2 to df1 but have not been able to:

s=df1['Name']
c=df2['cities']
s.str.findall('c')

Which just shows me the matches.

0 Answers
Related