I have two data frames which I am trying to merge based on matching values of few columns - Amount, Name, Year, Month.
df3 = pd.merge(df1,df2, left_on=['Name1','Year1','Month1','Amount1'],
right_on=['Name2','Year2','Month2','Amount2'])
I want to incorporate the condition such that a variance of 6 months and a variance of 1000$ is allowed This means - Besides, the exact matching, matching should even occur if there is a difference of at most 6 months between Month1 and Month2. Similarly, matching should also occur if the amount differ by at most 1000$. Year and Name should always have exact matches.