title: Sorting a pandas DataFrame by the order of a list
body: <p>So I have a pandas DataFrame, df, with columns that represent taxonomical classification (i.e. Kingdom, Phylum, Class etc...) I also have a list of taxonomic labels that correspond to the order I would like the DataFrame to be ordered by.</p>
  
  <p>The list looks something like this:</p>
  
  <pre><code>class_list=['Gammaproteobacteria', 'Bacteroidetes', 'Negativicutes', 'Clostridia', 'Bacilli', 'Actinobacteria', 'Betaproteobacteria', 'delta/epsilon subdivisions', 'Synergistia', 'Mollicutes', 'Nitrospira', 'Spirochaetia', 'Thermotogae', 'Aquificae', 'Fimbriimonas', 'Gemmatimonadetes', 'Dehalococcoidia', 'Oscillatoriophycideae', 'Chlamydiae', 'Nostocales', 'Thermodesulfobacteria', 'Erysipelotrichia', 'Chlorobi', 'Deinococci']
  </code></pre>
  
  <p>This list would correspond to the <code>Dataframe</code> column <code>df['Class']</code>. I would like to sort all the rows for the whole dataframe based on the order of the list as <code>df['Class']</code> is in a different order currently. What would be the best way to do this?</p>