"Pandas, filter rows which column contain another column",df[df['B'].str.contains('|'.join(df['A']))]