pandas check if column contains string and make label code example Example: dataframe column contains string df[df['A'].str.contains("hello")]