def sort_values(
        self,
        by,
        axis=0,
        ascending=True,
        inplace=False,
        kind="quicksort",
        na_position="last",
    ):
        """Sorts by a column/row or list of columns/rows.

        Args:
            by: A list of labels for the axis to sort over.
            axis: The axis to sort.
            ascending: Sort in ascending or descending order.
            inplace: If true, do the operation inplace.
            kind: How to sort.
            na_position: Where to put np.nan values.

        Returns:
             A sorted DataFrame.
        """
        axis = self._get_axis_number(axis)
        if not is_list_like(by):
            by = [by]
        # Currently, sort_values will just reindex based on the sorted values.
        # TODO create a more efficient way to sort
        if axis == 0:
            broadcast_value_dict = {col: self[col] for col in by}
            broadcast_values = pandas.DataFrame(broadcast_value_dict, index=self.index)
            new_index = broadcast_values.sort_values(
                by=by,
                axis=axis,
                ascending=ascending,
                kind=kind,
                na_position=na_position,
            ).index
            return self.reindex(index=new_index, copy=not inplace)
        else:
            broadcast_value_list = [
                self[row :: len(self.index)]._to_pandas() for row in by
            ]
            index_builder = list(zip(broadcast_value_list, by))
            broadcast_values = pandas.concat(
                [row for row, idx in index_builder], copy=False
            )
            broadcast_values.columns = self.columns
            new_columns = broadcast_values.sort_values(
                by=by,
                axis=axis,
                ascending=ascending,
                kind=kind,
                na_position=na_position,
            ).columns
            return self.reindex(columns=new_columns, copy=not inplace)
def sort_values ( self , by , axis = 0 , ascending = True , inplace = False , kind = "quicksort" , na_position = "last" , ) : axis = self . _get_axis_number ( axis ) if not is_list_like ( by ) : by = [ by ] if axis == 0 : broadcast_value_dict = { col : self [ col ] for col in by } broadcast_values = pandas . DataFrame ( broadcast_value_dict , index = self . index ) new_index = broadcast_values . sort_values ( by = by , axis = axis , ascending = ascending , kind = kind , na_position = na_position , ) . index return self . reindex ( index = new_index , copy = not inplace ) else : broadcast_value_list = [ self [ row : : len ( self . index ) ] . _to_pandas ( ) for row in by ] index_builder = list ( zip ( broadcast_value_list , by ) ) broadcast_values = pandas . concat ( [ row for row , idx in index_builder ] , copy = False ) broadcast_values . columns = self . columns new_columns = broadcast_values . sort_values ( by = by , axis = axis , ascending = ascending , kind = kind , na_position = na_position , ) . columns return self . reindex ( columns = new_columns , copy = not inplace )
Sorts by a column/row or list of columns/rows.

        Args:
            by: A list of labels for the axis to sort over.
            axis: The axis to sort.
            ascending: Sort in ascending or descending order.
            inplace: If true, do the operation inplace.
            kind: How to sort.
            na_position: Where to put np.nan values.

        Returns:
             A sorted DataFrame.