dataframe loc based on substring match in column code example Example: dataframe column contains string df[df['A'].str.contains("hello")]