title: Exploding a table into rows in pandas
body: <p>What is the best solution (performance) for exploding a table or matrix from python into rows that contains information from the columns and its values ? </p>
  
  <p>Let us say we have load a table in Pandas as the following:</p>
  
  <pre><code>Date    A   B   
  t1  1   2   
  t2  3   4   
  </code></pre>
  
  <p>I want to explode the table so it becomes a series of 4 lines as follows:</p>
  
  <pre><code>t1-A-1
  t1-B-2
  t2-A-3
  t2-C-4
  </code></pre>
  
  <p>Performance is key here once there might dozens of columns and hundreds of rows in the original table.</p>
  
  <p>what about the following:</p>
  
  <pre><code>Date    A   B   C
  t1  1   5   9
  t1  2   6   10
  t2  3   7   11
  t2  4   8   12
  </code></pre>
  
  <p>The output series would be:</p>
  
  <pre><code>Date    code
  t1  "str1"1"str2"B"str2"5
  t1  "str1"2"str2"B"str2"6
  t2  "str1"3"str2"B"str2"7
  t2  "str1"4"str2"B"str2"8
  ..  ..
  t2  "str1"4"str2"C"str2"12
  </code></pre>
  
  <p>I appreciate your help! </p>