title: How can I merge rows in np matrix?
body: <p>I've got a numpy matrix that has 2 rows and N columns, e.g. (if <code>N=4</code>):</p>
  
  <pre><code>[[ 1  3  5   7]
   [ 2  4  6   8]]
  </code></pre>
  
  <p>The goal is create a string <code>1,2,3,4,5,6,7,8</code>.</p>
  
  <ul>
  <li>Merge the rows such that the elements from the first row have the even (1, 3, ..., N - 1) positions (the index starts from 1) and the elements from the second row have the odd positions (2, 4, ..., N).</li>
  </ul>
  
  <p>The following code works but it isn't really nice:</p>
  
  <pre><code>    xs = []
      for i in range(number_of_cols):
          xs.append(nums.item(0, i))
      ys = []
      for i in range(number_of_cols):
          ys.append(nums.item(1, i))
      nums_str = ""
      for i in range(number_of_cols):
          nums_str += '{},{},'.format(xs[i], ys[i])
  </code></pre>
  
  <ul>
  <li>Join the result list with a comma as a delimiter (<code>row.join(',')</code>)</li>
  </ul>
  
  <p>How can I merge the rows using built in functions (or just in a more elegant way overall)?</p>