DataFrame.sort()

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

Examples

>>> result = df.sort(['A', 'B'], ascending=[1, 0])
doc_Pandas
2017-01-12 04:46:34
Comments
Leave a Comment

Please login to continue.