h2o-py/h2o/frame.py
def asfactor(self):
        """
        Convert columns in the current frame to categoricals.

        :returns: new H2OFrame with columns of the "enum" type.
        """
        for colname in self.names:
            t = self.types[colname]
            if t not in {"bool", "int", "string", "enum"}:
                raise H2OValueError("Only 'int' or 'string' are allowed for "
                                    "asfactor(), got %s:%s " % (colname, t))
        fr = H2OFrame._expr(expr=ExprNode("as.factor", self), cache=self._ex._cache)
        if fr._ex._cache.types_valid():
            fr._ex._cache.types = {name: "enum" for name in self.types}
        else:
            raise H2OTypeError("Types are not available in result")
        
        return fr
def asfactor(self):
        for colname in self.names:
            t = self.types[colname]
            if t not in {"bool", "int", "string", "enum"}:
                raise H2OValueError("Only 'int' or 'string' are allowed for "
                                    "asfactor(), got %s:%s " % (colname, t))
        fr = H2OFrame._expr(expr=ExprNode("as.factor", self), cache=self._ex._cache)
        if fr._ex._cache.types_valid():
            fr._ex._cache.types = {name: "enum" for name in self.types}
        else:
            raise H2OTypeError("Types are not available in result")
        
        return fr
def asfactor ( self ) : for colname in self . names : t = self . types [ colname ] if t not in { "bool" , "int" , "string" , "enum" } : raise H2OValueError ( "Only 'int' or 'string' are allowed for " "asfactor(), got %s:%s " % ( colname , t ) ) fr = H2OFrame . _expr ( expr = ExprNode ( "as.factor" , self ) , cache = self . _ex . _cache ) if fr . _ex . _cache . types_valid ( ) : fr . _ex . _cache . types = { name : "enum" for name in self . types } else : raise H2OTypeError ( "Types are not available in result" ) return fr
Convert columns in the current frame to categoricals.

        :returns: new H2OFrame with columns of the "enum" type.
Convert columns in the current frame to categoricals .