title: Python - Splitting multiple columns by delimiter
body: <p>Note: I'm a beginner with Python and just started using Pandas a couple days ago.  I have a background in R.</p>
  
  <p>I'm trying to split a pandas DataFrame, but can only seem to split one column at a time by one delimiter at a time.</p>
  
  <p>My data looks like this:</p>
  
  <pre><code>                          0         1             2            3  \
  0    chr4:43571332-43571643  numsnp=3    length=312  state1,cn=0   
  1  chr5:179618873-179628421  numsnp=8  length=9,549  state1,cn=0   
  
                    4                 5               6  
  0  CCCC.A_1_TR27GD1  startsnp=S-3TZTE  endsnp=S-4NDOX  
  1  CCCC.A_1_TR27GD1  startsnp=S-3IDBJ  endsnp=S-4AKVJ 
  </code></pre>
  
  <p>I want my output to look like this:</p>
  
  <pre><code>  Chromosome      Start        End NumSNP Length StartSNP   EndSNP
  0          4   43571332   43571643      3    312  S-3TZTE  S-4NDOX
  1          5  179618873  179628421      8  9,549  S-3IDBJ  S-4AKVJ
  </code></pre>
  
  <p>I know this is a lot, but this involves the following:</p>
  
  <ul>
  <li>Split column 0 by : and -....also removing the "chr"</li>
  <li>Split columns 1,2,5,6</li>
  <li>Rename &amp; reorder columns</li>
  <li>etc</li>
  </ul>
  
  <p><strong>QUESTION:</strong>
  I've been able to do it using the code below, but would like some guidance into a more efficient code.</p>
  
  <pre><code>import pandas as pd
  
  CNV = pd.read_csv('CCCC_cnv_practice.rawcnv', delimiter="\s+", engine='python', header=None)
  
  #Get Chromosomes
  ChrPos = pd.DataFrame(CNV[0].str.split(':',1).tolist(), columns = ['Chromosome','Position'])
  Chromosome = ChrPos['Chromosome'].str.lstrip('chr')
  
  #Get Start and End Positions
  Positions = pd.DataFrame(ChrPos.Position.str.split('-',1).tolist(), columns = ['Start','End'])
  
  #Get the Numsnp, Length, StartSNP, and EndSNP columns
  Equals1 = CNV.iloc[:,1:3]
  Equals2 = CNV.iloc[:,5:]
  Equals = Equals1.join(Equals2)
  
  TEST1 = pd.DataFrame(Equals[1].str.split('=',1).tolist())
  TEST2 = pd.DataFrame(Equals[2].str.split('=',1).tolist())
  TEST3 = pd.DataFrame(Equals[5].str.split('=',1).tolist())
  TEST4 = pd.DataFrame(Equals[6].str.split('=',1).tolist())
  
  #Put it all together
  frames = [Chromosome, Positions, TEST1[1], TEST2[1], TEST3[1], TEST4[1]]
  Data = pd.concat(frames, axis=1)
  Data.columns = ['Chromosome', 'Start', 'End', 'NumSNP', 'Length', 'StartSNP', 'EndSNP']
  </code></pre>