title: python - sorting floats within elements of an array based on another array
body: <p>I have a data array looks, for example, like:</p>
  
  <pre><code>data = [
      [1.4, 2.6, 7.3, 4.2],
      [1.1, 2.0, 6.4, 1.0],
      [5.1, 6.2, 5.3, 9.9]
  ]
  </code></pre>
  
  <p>and another array with class labels:</p>
  
  <pre><code>class_labels = ['a', 'b', 'a', 'b']
  </code></pre>
  
  <p>Each of the class labels corresponds to certain floats in each element of the data array (e.g., class <code>'a'</code> corresponds to <code>1.4</code> and <code>7.3</code> from <code>data[0]</code>, <code>1.1</code> and <code>6.4</code> from <code>data[1]</code>, and <code>5.1</code> and <code>5.3</code> from <code>data[0]</code>).</p>
  
  <p>I understand from other posts how I could go about sorting one array based on another array, but is it possible to sort the <code>class_labels</code> array alphabetically, also sorting the corresponding floats within each element of the data array?</p>
  
  <p>It's possible I've totally gone about this wrong - if I want to be able to later access certain floats from each element (i.e., only floats corresponding to a given class label), will that be possible?</p>
  
  <p>Thanks for any advice!</p>