h2o-py/h2o/frame.py
def sort(self, by, ascending=[]):
        """
        Return a new Frame that is sorted by column(s) in ascending order. A fully distributed and parallel sort.
        However, the original frame can contain String columns but sorting cannot be done on String columns.
        Default sorting direction is ascending.

        :param by: The column to sort by (either a single column name, or a list of column names, or
            a list of column indices)
        :param ascending: Boolean array to denote sorting direction for each sorting column.  True for ascending
            sort and False for descending sort.

        :return:  a new sorted Frame
        """
        assert_is_type(by, str, int, [str, int])
        if type(by) != list: by = [by]
        if type(ascending) != list: ascending = [ascending]   # convert to list
        ascendingI=[1]*len(by)  # intitalize sorting direction to ascending by default
        for c in by:
            if self.type(c) not in ["enum","time","int","real","string"]:
                raise H2OValueError("Sort by column: " + str(c) + " not of enum, time, int, real, or string type")
        if len(ascending)>0:  # user did not specify sort direction, assume all columns ascending
            assert len(ascending)==len(by), "Sorting direction must be specified for each sorted column."
            for index in range(len(by)):
                ascendingI[index]=1 if ascending[index] else -1
        return H2OFrame._expr(expr=ExprNode("sort",self,by,ascendingI))
def sort(self, by, ascending=[]):
        """
        Return a new Frame that is sorted by column(s) in ascending order. A fully distributed and parallel sort.
        However, the original frame can contain String columns but sorting cannot be done on String columns.
        Default sorting direction is ascending.

        :param by: The column to sort by (either a single column name, or a list of column names, or
            a list of column indices)
        :param ascending: Boolean array to denote sorting direction for each sorting column.  True for ascending
            sort and False for descending sort.

        :return:  a new sorted Frame
        """
        assert_is_type(by, str, int, [str, int])
        if type(by) != list: by = [by]
        if type(ascending) != list: ascending = [ascending]   # convert to list
        ascendingI=[1]*len(by)  # intitalize sorting direction to ascending by default
        for c in by:
            if self.type(c) not in ["enum","time","int","real","string"]:
                raise H2OValueError("Sort by column: " + str(c) + " not of enum, time, int, real, or string type")
        if len(ascending)>0:  # user did not specify sort direction, assume all columns ascending
            assert len(ascending)==len(by), "Sorting direction must be specified for each sorted column."
            for index in range(len(by)):
                ascendingI[index]=1 if ascending[index] else -1
        return H2OFrame._expr(expr=ExprNode("sort",self,by,ascendingI))
def sort ( self , by , ascending = [ ] ) : assert_is_type ( by , str , int , [ str , int ] ) if type ( by ) != list : by = [ by ] if type ( ascending ) != list : ascending = [ ascending ] # convert to list ascendingI = [ 1 ] * len ( by ) # intitalize sorting direction to ascending by default for c in by : if self . type ( c ) not in [ "enum" , "time" , "int" , "real" , "string" ] : raise H2OValueError ( "Sort by column: " + str ( c ) + " not of enum, time, int, real, or string type" ) if len ( ascending ) > 0 : # user did not specify sort direction, assume all columns ascending assert len ( ascending ) == len ( by ) , "Sorting direction must be specified for each sorted column." for index in range ( len ( by ) ) : ascendingI [ index ] = 1 if ascending [ index ] else - 1 return H2OFrame . _expr ( expr = ExprNode ( "sort" , self , by , ascendingI ) )
Return a new Frame that is sorted by column(s) in ascending order. A fully distributed and parallel sort.
        However, the original frame can contain String columns but sorting cannot be done on String columns.
        Default sorting direction is ascending.

        :param by: The column to sort by (either a single column name, or a list of column names, or
            a list of column indices)
        :param ascending: Boolean array to denote sorting direction for each sorting column.  True for ascending
            sort and False for descending sort.

        :return:  a new sorted Frame
Return a new Frame that is sorted by column ( s ) in ascending order . A fully distributed and parallel sort . However the original frame can contain String columns but sorting cannot be done on String columns . Default sorting direction is ascending .