title: Python - Split a row into columns - csv data
body: <p>Am trying to read data from csv file, split each row into respective columns.  </p>
  
  <p>But my regex is failing when a particular column has <strong>commas with in itself</strong>.  </p>
  
  <p>eg: a,b,c,"d,e, g,",f  </p>
  
  <p>I want result like:   </p>
  
  <pre><code>a    b    c    "d,e, g,"    f  
  </code></pre>
  
  <p>which is 5 columns.</p>
  
  <p>Here is the regex am using to split the string by comma  </p>
  
  <blockquote>
    <p>,(?=(?:"[^"]<em>?(?:[^"]</em>)*))|,(?=[^"]+(?:,)|,+|$)</p>
  </blockquote>
  
  <p>but it fails for few strings while it works for others.  </p>
  
  <p>All am looking for is, when I read data from csv using pyspark into dataframe/rdd, I want to load/preserve all the columns without any mistakes  </p>
  
  <p>Thank You</p>