title: Python/pandas - Add word in column based on words in another column
body: <p>I'm working with an xlsx file with pandas and I would like to add the word "bodypart" in a column if the preceding column contains a word in a predefined list of bodyparts.</p>
  
  <p>Original Dataframe:</p>
  
  <pre><code>Sentence   Type
  my hand    NaN
  the fish   NaN
  </code></pre>
  
  <p>Result Dataframe:</p>
  
  <pre><code>Sentence   Type
  my hand    bodypart
  the fish   NaN
  </code></pre>
  
  <p>Nothing I've tried works. I feel I'm missing something very obvious. Here's my last (failed) attempt:</p>
  
  <pre><code>import pandas as pd 
  import numpy as np
  bodyparts = ['lip ', 'lips ', 'foot ', 'feet ', 'heel ', 'heels ', 'hand ', 'hands ']
  
  df = pd.read_excel(file)
  
  for word in bodyparts :
      if word in df["Sentence"] : df["Type"] = df["Type"].replace(np.nan, "bodypart", regex = True)
  </code></pre>
  
  <p>I also tried this, with as variants "NaN" and NaN as the first argument of str.replace:</p>
  
  <pre><code>if word in df['Sentence'] : df["Type"] = df["Type"].str.replace("", "bodypart")
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>