title: Remapping strings with similar (but slightly differing) substrings to the same result
body: <p>I have a dataframe as below :</p>
  
  <pre><code>df = pd.DataFrame({
  "group_code": ['111', '111', '111', '111', '111', '111', '111', '222', '222','222', '222', '222', '222'],
  "ind_code": ['K M trading', 'K.M trad', 'KM trading LL', 'bill payment', 'pays', 'PayMent', 'Payer', 'Rev12','Rev11','13 rev','Rev13','Rev .!','REV 17']
  })
  </code></pre>
  
  <p>I wanted to group all the values in the column :
  <code>'K M trading', 'K.M trad', 'KM trading LL'</code> as <code>"KM Trading"</code>.
  Can any one plase help me?</p>
  
  <p>I tried the below code, but its not working </p>
  
  <pre><code> def replace_(row):
  if 'pay' in row.lower():
      return 'Payment'
  if 'rev' in row.lower():
      return 'Rev'
  if 'km' in row.lower():
      return 'KM Trade'
  else:
  return row
  df.ind_code = df.ind_code.apply(lambda row : replace_(row))
  print(df)
  </code></pre>