<p>你的问题:这是两种方法之间唯一的区别吗?</p>
<h2>熊猫0.17.0最终发布之前(即2015-10-09之前)</h2>
<p>简短回答:是的。它们在功能上是等价的。</p>
<p>更长的答案:</p>
<p><a href="http://pandas.pydata.org/pandas-docs/version/0.16.2/generated/pandas.Series.order.html#pandas.Series.order" rel="noreferrer">^{<cd3>}</a>:更改对象本身(就地排序),但不返回任何内容。</p>
<blockquote>
<p>Sort values and index labels by value. This is an <em>inplace sort</em> by default. <strong><code>Series.order</code> is the equivalent but returns a new Series.</strong></p>
</blockquote>
<p>所以</p>
<pre><code>>>> s = pd.Series([3,4,0,3]).sort()
>>> s
</code></pre>
<p>没有输出。有关详细信息,请参见<a href="https://stackoverflow.com/a/33572274/2303761">the answer here</a>。</p>
<p><a href="http://pandas.pydata.org/pandas-docs/version/0.16.2/generated/pandas.Series.sort.html#pandas.Series.sort" rel="noreferrer">^{<cd4>}</a>:不更改对象,而是返回一个新的排序对象。</p>
<blockquote>
<p>Sorts Series object, by value, maintaining index-value link. This will <em>return a new Series</em> by default. <strong><code>Series.sort</code> is the equivalent but as an inplace method.</strong></p>
</blockquote>
<hr/>
<h2>熊猫0.17.0最终发布后(即2015-10-09之后)</h2>
<p>排序的API是<a href="http://pandas.pydata.org/pandas-docs/stable/whatsnew.html#changes-to-sorting-api" rel="noreferrer">changed</a>,事情变得更干净、更愉快。</p>
<p>要按<strong>值排序,不推荐使用<code>Series.sort()</code>和<code>Series.order()</code>,取而代之的是新的<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.sort_values.html#pandas.Series.sort_values" rel="noreferrer"><strong>^{<cd7>}</strong></a>api,它返回一个已排序的序列对象。</p>
<p>总结这些变化(摘自pandas 0.17.0<a href="http://pandas.pydata.org/pandas-docs/stable/whatsnew.html#changes-to-sorting-api" rel="noreferrer">doc</a>):</p>
<pre><code>To sort by the values (A * marks items that will show a FutureWarning):
Previous | Replacement
------------------------------|-----------------------------------
* Series.order() | Series.sort_values()
* Series.sort() | Series.sort_values(inplace=True)
* DataFrame.sort(columns=...) | DataFrame.sort_values(by=...)
</code></pre>