擅长:python、mysql、java
<p>签出<code>sortlevel</code>(<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sortlevel.html" rel="nofollow">docs</a>)或<code>sort_index</code>(<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.sort_index.html" rel="nofollow">docs</a>)。</p>
<pre><code>df.sortlevel(level=[0, 1])
</code></pre>
<p>以及</p>
^{pr2}$
<p>两种输出</p>
<pre><code>Crop Region
maize_1 Temperate 30
Tropical 46.0
maize_2 Temperate 13.5
Tropical 77.5
soybean_1 Temperate 18.5
Tropical 35.0
</code></pre>