title: How to split Dataframe column into two parts and replace column with splitted value
body: <p>How can I split a dataframe column into two parts such that the value in dataframe column is later replaced by the splitted value.
  For example, I have a dataframe like :</p>
  
  <pre><code>col1       col2
  "abc"      "A, BC"
  "def"      "AX, Z"
  "pqr"      "P, R"
  "xyz"      "X, YZ"
  </code></pre>
  
  <p>I want to extract values before , and replace that cell with the extracted value.
  So, the output should look like :</p>
  
  <pre><code>col1   col2
  abc    A
  def    AX
  pqr    P
  xyz    X
  </code></pre>
  
  <p>I am trying to do it as : </p>
  
  <pre><code>df['col2'].apply(lambda x: x.split(',')[0])
  </code></pre>
  
  <p>But it gives me error. Please suggest how can I get the desired output.</p>