0

I have 2 dataframes having values as:

df1: enter image description here

df2: enter image description here

I want to do left join df1 with df2, on basis of office & year. But the office column seems to be need something like df2.Geography contains df1.office.

How to do that ? Also df2 have duplicates values for office. The first row having matched would be good enough.

Thanks for your help.

Edit1:

Here's my code. But it's - I'm using year because I dont know how to join on office.

completedata_external = pd.merge(df1,df2,left_on=['year'], right_on=['Year'],how="left")



 
Akhan
  • 425
  • 1
  • 7
  • 21
  • 2
    Please read [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) – Space Impact Aug 12 '20 at 17:10
  • Thanks I have added my code. I know how to join but the problem is the values in the join column of df2 cannot be joined by merely matching on the basis of = operator. Seems i need some kind of str.contains functionality inside join statement. – Akhan Aug 12 '20 at 17:46

0 Answers0