title: How to reorder indexed rows based on a list in Pandas data frame
body: <p>I have a data frame that looks like this:</p>
  <pre><code>company  Amazon  Apple  Yahoo
  name
  A             0    130      0
  C           173      0      0
  Z             0      0    150
  </code></pre>
  <p>It was created using this code:</p>
  <pre><code>import pandas as pd
  df = pd.DataFrame({'name' : ['A', 'Z','C'],
                     'company' : ['Apple', 'Yahoo','Amazon'],
                     'height' : [130, 150,173]})
  
  df = df.pivot(index=&quot;name&quot;, columns=&quot;company&quot;, values=&quot;height&quot;).fillna(0)
  </code></pre>
  <p>What I want to do is to sort the row (with index <code>name</code>) according to a predefined list:</p>
  <pre><code>[&quot;Z&quot;, &quot;C&quot;, &quot;A&quot;]`
  </code></pre>
  <p>Resulting in this :</p>
  <pre><code>company  Amazon  Apple  Yahoo
  name
  Z             0      0    150
  C           173      0      0
  A             0    130      0
  </code></pre>
  <p>How can I achieve that?</p>