df['nb_months'] = ((df.date2 - df.date1)/np.timedelta64(1, 'M'))

df['nb_months'] = df['nb_months'].astype(int)