Let\'s say my data frame contains these data:
>>> df = pd.DataFrame({\'a\':[\'l1\',\'l2\',\'l1\',\'l2\',\'l1\',\'l2\'], \'b\'
df['c'] = (df.a.apply(lambda x: x[1:])==df.b).astype(int)