Python pandas dataframe regex to extract substring from object
<p>I created a dataframe in python using pandas module from a csv file. Pandas by default converted string into object type. Now from that string, I wanted to create another column which I am trying to create using regex. However, because the column is object I am getting error </p>

<pre><code>data = pd.read_csv(r'Desktop\train.csv')
desig = re.search(r'(\w+), (\w+). (\w+)',data['Name']).group(1)
</code></pre>

<blockquote>
  <p>TypeError: expected string or buffer</p>
</blockquote>

<p>How can I extract the portion from the object?</p>

<p>Thanks.</p>