title: Replace whole string if it contains substring in pandas dataframe
body: <p>I have an sample dataset. </p>
  
  <pre><code>raw_data = {
      'categories': ['sweet beverage', 'salty snacks', 'beverage,sweet', 'fruit juice,beverage,', 'salty crackers'],
      'product_name': ['coca-cola', 'salted pistachios', 'fruit juice', 'lemon tea', 'roasted peanuts']}
  df_a = pd.DataFrame(raw_data)
  </code></pre>
  
  <p>I need to iterate thru the rows in the 'categories' columns, and check if it contains a particular string, in this case, 'beverage', after which i will update the categories to just 'beverage'. This link is the closest i found on stackoverflow, but doesnt tell me how to go thru the whole dataset. </p>
  
  <p><a href="https://stackoverflow.com/questions/39768547/replace-whole-string-if-it-contains-substring-in-pandas">Replace whole string if it contains substring in pandas</a></p>
  
  <p>Here's my sample code. </p>
  
  <pre><code>for index,row in df.iterrows():
      if row.str.contains('beverage', na=False):
          df.loc[index,'categories_en'] = 'Beverages' 
      elif row.str.contains('salty',na=False):
          df.loc[index,'categories_en'] = 'Salty Snack'
       ....&lt;and other conditions&gt;
  </code></pre>
  
  <p>How can I achive this? Thanks all!</p>