title: How to filter based on the some part of a value of rows in a pandas dataframe
body: <p>I have a pandas dataframe as below:</p>
  
  <pre><code>   +------+---+
     |Name  |age|
     +------+---+
     |Mona  |12 |
     +------+---+
     |Monika|25 |
     +------+---+
     |Tomas |3  |
     +------+---+
     |Ilyas |47 |
     +------+---+
  </code></pre>
  
  <p>Now, I want to assign some values in a new column to the <code>Name</code> column contains some substring. For example if it contains Mon then we assign <code>text</code> to them and if it contains <code>as</code> we assign <code>city</code> to them.</p>
  
  <p>So the output must be:</p>
  
  <pre><code>   +------+---+----+
     |Name  |age|new |
     +------+---+----+
     |Mona  |12 |text|
     +------+---+----+
     |Monika|25 |text|
     +------+---+----+
     |Tomas |3  |city|
     +------+---+----|
     |Ilyas |47 |city|
     +------+---+----+
  </code></pre>
  
  <p>I wrote the following codes and it didn't work:</p>
  
  <pre><code>df['new'] = np.nan    
  df['new'] = df['new'].mask( 'Mon' in df['Name'], 'text')    
  df['new'] = df['new'].mask( 'as' in df['Name'], 'city')
  </code></pre>