DataFrame.sort(columns=None, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last', **kwargs)
[source]
DEPRECATED: use DataFrame.sort_values()
Sort DataFrame either by labels (along either axis) or by the values in column(s)
Parameters: |
columns : object Column name(s) in frame. Accepts a column name or a list for a nested sort. A tuple will be interpreted as the levels of a multi-index. ascending : boolean or list, default True Sort ascending vs. descending. Specify list for multiple sort orders axis : {0 or ‘index’, 1 or ‘columns’}, default 0 Sort index/rows versus columns inplace : boolean, default False Sort the DataFrame without creating a new instance kind : {‘quicksort’, ‘mergesort’, ‘heapsort’}, optional This option is only applied when sorting on a single column or label. na_position : {‘first’, ‘last’} (optional, default=’last’) ‘first’ puts NaNs at the beginning ‘last’ puts NaNs at the end |
---|---|
Returns: |
sorted : DataFrame |
>>> result = df.sort(['A', 'B'], ascending=[1, 0])
© 2011–2012 Lambda Foundry, Inc. and PyData Development Team
© 2008–2011 AQR Capital Management, LLC
© 2008–2014 the pandas development team
Licensed under the 3-clause BSD License.
http://pandas.pydata.org/pandas-docs/version/0.19.2/generated/pandas.DataFrame.sort.html