title: Python: How to create a lookup table for string matching
body: <p>I need to parse each row of a csv and add a new column by matching if an existing column matches a pattern. For example, if columnA starts with the string <code>elephant</code> then I will add a new column called <code>Mammal</code>.</p>
  <p>So, the file is like</p>
  <pre><code>uid   datetime         description 
   1    2015-09-01       an elephant has trunks
   2    2015-08-31       there are sharks in the sea
  </code></pre>
  <p>So, I want to search the <code>description</code> column and add a new column called <code>animal</code> which will identify the type of animal we are talking about. So, the new csv will be</p>
  <pre><code>uid   datetime         description                       animal
   1    2015-09-01       an elephant has trunks            mammal
   2    2015-08-31       there are sharks in the sea       fish
  </code></pre>
  <p>This is a rather simplified example but I essentially need to create a lookup for the animal type and the description.</p>