title: Python: Sorting y value array according to ascending x array
body: <p>If I had two arrays of the form:</p>
  
  <pre><code>x = [0, 7, 2, 4, 6, 9, 5]
  
  y = [1, 2, 3, 4, 5, 6, 7]
  </code></pre>
  
  <p>i.e., I have data points at <code>[0,1]</code>, <code>[3,2]</code>, <code>[x_n,y_n]</code> etc. How would I organise <code>y</code> for a corresonding ascending <code>x</code> value? In other words I end up with ascending values of <code>x</code>:</p>
  
  <pre><code>x = [0, 2, 4, 5, 6, 7, 9]
  </code></pre>
  
  <p>Matched to their corresponding <code>y</code> values:</p>
  
  <pre><code>y = [1, 3, 4, 7, 5, 2, 6]
  </code></pre>
  
  <p>I'm guessing I would need to stitch the two arrays together then sort according to <code>x</code>, but I'm not quite sure of the exact syntax for this. Any helps would be greatly appreciated.</p>