h2o-py/h2o/frame.py
def topNBottomN(self, column=0, nPercent=10, grabTopN=-1):
        """
        Given a column name or one column index, a percent N, this function will return the top or bottom N% of the
         values of the column of a frame.  The column must be a numerical column.
    
        :param column: a string for column name or an integer index
        :param nPercent: a top or bottom percentage of the column values to return
        :param grabTopN: -1 to grab bottom N percent and 1 to grab top N percent
        :returns: a H2OFrame containing two columns.  The first column contains the original row indices where
            the top/bottom values are extracted from.  The second column contains the values.
        """
        assert (nPercent >= 0) and (nPercent<=100.0), "nPercent must be between 0.0 and 100.0"
        assert round(nPercent*0.01*self.nrows)>0, "Increase nPercent.  Current value will result in top 0 row."

        if isinstance(column, int):
            if (column < 0) or (column>=self.ncols):
                raise H2OValueError("Invalid column index H2OFrame")
            else:
                colIndex = column
        else:       # column is a column name
            col_names = self.names
            if column not in col_names:
                raise H2OValueError("Column name not found H2OFrame")
            else:
                colIndex = col_names.index(column)

        if not(self[colIndex].isnumeric()):
            raise H2OValueError("Wrong column type!  Selected column must be numeric.")

        return H2OFrame._expr(expr=ExprNode("topn", self, colIndex, nPercent, grabTopN))
def topNBottomN(self, column=0, nPercent=10, grabTopN=-1):
        """
        Given a column name or one column index, a percent N, this function will return the top or bottom N% of the
         values of the column of a frame.  The column must be a numerical column.
    
        :param column: a string for column name or an integer index
        :param nPercent: a top or bottom percentage of the column values to return
        :param grabTopN: -1 to grab bottom N percent and 1 to grab top N percent
        :returns: a H2OFrame containing two columns.  The first column contains the original row indices where
            the top/bottom values are extracted from.  The second column contains the values.
        """
        assert (nPercent >= 0) and (nPercent<=100.0), "nPercent must be between 0.0 and 100.0"
        assert round(nPercent*0.01*self.nrows)>0, "Increase nPercent.  Current value will result in top 0 row."

        if isinstance(column, int):
            if (column < 0) or (column>=self.ncols):
                raise H2OValueError("Invalid column index H2OFrame")
            else:
                colIndex = column
        else:       # column is a column name
            col_names = self.names
            if column not in col_names:
                raise H2OValueError("Column name not found H2OFrame")
            else:
                colIndex = col_names.index(column)

        if not(self[colIndex].isnumeric()):
            raise H2OValueError("Wrong column type!  Selected column must be numeric.")

        return H2OFrame._expr(expr=ExprNode("topn", self, colIndex, nPercent, grabTopN))
Given a column name or one column index, a percent N, this function will return the top or bottom N% of the
         values of the column of a frame.  The column must be a numerical column.
    
        :param column: a string for column name or an integer index
        :param nPercent: a top or bottom percentage of the column values to return
        :param grabTopN: -1 to grab bottom N percent and 1 to grab top N percent
        :returns: a H2OFrame containing two columns.  The first column contains the original row indices where
            the top/bottom values are extracted from.  The second column contains the values.