bach.DataFrame.sort_values
sort_values
(by, ascending=True)Create a new DataFrame with the specified sorting order.
This does not modify the current DataFrame, instead it returns a new DataFrame.
The sorting will remain in the returned DataFrame as long as no operations are performed on that
frame that materially change the selected data. Operations that materially change the selected data
are for example groupby()
, merge()
, materialize()
, and filtering out rows.
Adding or removing a column does not materially change the selected data.
Parameters
by
(Union[str, List[str]]) – column label or list of labels to sort by.ascending
(Union[bool, List[bool]]) – Whether to sort ascending (True) or descending (False). If this is a list, then theby
must also be a list andlen(ascending) == len(by)
.
Returns
a new DataFrame with the specified ordering.