title: Extracting multiple new tab delimited files from an existing one
body: <p>Hi I am trying to split up a a large metadate file in Python. I started using pandas and wasn't able to figure it out. Right now it's a tab delimited file that looks something like:</p>
  
  <pre><code>id       count
  MD1_G1   k123
  MD1_G2   k34
  MD2_G3   k5678
  MD2_G4   k50633
  MD4_G5   k100
  </code></pre>
  
  <p>First I wanted to try and split that first column into two. This is what I have so far:</p>
  
  <pre><code>df = pd.read_table('Table1.txt',names=["id","count"])
  #This below was my attempt at trying to split that first column
  df_tmp = pd.DataFrame(df.id.str.split('_',1).tolist(),columns=['id','descriptor'])
  </code></pre>
  
  <p>I managed to split that first column but I don't know how to do it while  keeping the original <code>count</code> column. </p>
  
  <p>Once I split that column I wanted to try and iteratively go through and create a new tab delimited file for each unique ID. So in this example I want to get to a situation where I make 3 new files from the original that contain information only from the unique ID. So using the example, I want to get to a situation where I ultimately have 3 new files:</p>
  
  <p>file 1: </p>
  
  <pre><code>MD1  G1  k123
  MD1  G2  k34
  </code></pre>
  
  <p>file 2:</p>
  
  <pre><code>MD2  G3   k5678
  MD2  G4   k50633
  </code></pre>
  
  <p>file 3:</p>
  
  <pre><code>MD4  G5   k100
  </code></pre>
  
  <p>If anyone has any ideas please let me know!</p>