title: Organize dictionary data by matching headers
body: <p>I have data in a dictionary which looks like this </p>
  
  <p>table-1</p>
  
  <pre><code>20140201      AA    AB        BC     DD       DA      AK     AL         
  20140201    0.212   0.445   0.453   0.223   0.422   0.772   0.543           
  
  20140202    AA        AB      DD      DA      AJ                    
  20140202    0.343   0.355   0.566   0.343   0.455           
  
  20140203    DC        AB      DD      DA      AJ      DS                
  20140203    0.345   0.445   0.246   0.677   0.773   0.823   
  </code></pre>
  
  <p>I want to organize it to the following:</p>
  
  <p>table-2   </p>
  
  <pre><code>              AA      AB    BC      DD       DA      AK      AL     AJ      DC     DS
  20140201    0.212   0.445   0.453  0.223    0.422   0.772   0.543   0       0      0
  20140202    0.343   0.355   0      0.566    0.343   0       0.543   0.455   0      0
  20140203    0       0.445   0      0.246    0.677   0          0    0.773   0.345  0.823
  </code></pre>
  
  <p>I have tried to do it for the first tick AA and did not took dates into account </p>
  
  <pre><code>t_code = 'AA'
  data_AA =[]
  for dt in range(len(d_data)):
      if ( (tkrs[dt].str.match(t_code)).sum()! =0):
          data_AA.append(d_data[dt].iloc[1,1])
      else:
          data_AA.append(0)
  </code></pre>
  
  <p>where d_data is numerical data read from the table-1 and tkrs are header (e.g, AA) for each dictionary item. Any suggestion/hints on this please.</p>
  
  <p><strong>EDIT:</strong>
  Originally data had the following form:</p>
  
  <pre><code>table-1a                      table-1b            
      AA, 20140201,    0.212      AA, 20140202,  0.343    
      AB, 20140201,    0.445      AB, 20140202,  0.355  
      BC, 20140201,    0.453      DD, 20140202,  0.566
      DD, 20140201,    0.223      DA, 20140202,  0.343   
      DA, 20140201,    0.422      AJ, 20140202,  0.455 
      AK, 20140201,    0.772   
      AL, 20140201,    0.543  
  </code></pre>
  
  <p>and so on.</p>