本文整理汇总了Python中expr.h2o.rapids函数的典型用法代码示例。如果您正苦于以下问题:Python rapids函数的具体用法?Python rapids怎么用?Python rapids使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rapids函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _eager
def _eager(self, pytmp=True):
if not self._computed:
# top-level call to execute all subparts of self._ast
sb = self._ast._eager()
if pytmp:
h2o.rapids(ExprNode._collapse_sb(sb), self._id)
sb = ["%", self._id," "]
self._update() # fill out _nrows, _ncols, _col_names, _computed
return sb
示例2: setNames
def setNames(self,names):
"""
Change the column names to `names`.
:param names: A list of strings equal to the number of columns in the H2OFrame.
:return: None. Rename the column names in this H2OFrame.
"""
h2o.rapids(ExprNode("colnames=", self, range(self.ncol()), names)._eager())
self._update()
return self
示例3: setName
def setName(self,col=None,name=None):
"""
Set the name of the column at the specified index.
:param col: Index of the column whose name is to be set.
:param name: The new name of the column to set
:return: the input frame
"""
if not isinstance(col, int) and self.ncol() > 1: raise ValueError("`col` must be an index. Got: " + str(col))
if self.ncol() == 1: col = 0
h2o.rapids(ExprNode("colnames=", self, col, name)._eager())
self._update()
return self
示例4: setLevels
def setLevels(self, levels):
"""
Works on a single categorical vector. New domains must be aligned with the old domains. This call has SIDE
EFFECTS and mutates the column in place (does not make a copy).
:param level: The level at which the column will be set (a string)
:param x: A single categorical column.
:param levels: A list of strings specifying the new levels. The number of new levels must match the number of
old levels.
:return: None
"""
h2o.rapids(ExprNode("setDomain", self, levels)._eager())
self._update()
return self
示例5: __setitem__
def __setitem__(self, b, c):
"""
Replace a column in an H2OFrame.
:param b: A 0-based index or a column name.
:param c: The vector that 'b' is replaced with.
:return: Returns this H2OFrame.
"""
update_index=-1
if isinstance(b, (str,unicode)): update_index=self.col_names().index(b) if b in self.col_names() else self._ncols
elif isinstance(b, int): update_index=b
lhs = ExprNode("[", self, b, None) if isinstance(b,H2OFrame) else ExprNode("[", self, None, update_index)
rhs = c._frame() if isinstance(c,H2OFrame) else c
col_name = b if (update_index==self._ncols and isinstance(b, (str, unicode))) else ( c._col_names[0] if isinstance(c, H2OFrame) else "" )
sb = ExprNode(",", ExprNode("=",lhs,rhs), ExprNode("colnames=",self,update_index,col_name))._eager() if update_index >= self.ncol() else ExprNode("=",lhs,rhs)._eager()
h2o.rapids(ExprNode._collapse_sb(sb))
self._update()
示例6: _eager
def _eager(self, pytmp=True):
if not self._computed:
# top-level call to execute all subparts of self._ast
sb = self._ast._eager()
if pytmp:
res = h2o.rapids(ExprNode._collapse_sb(sb), self._id)
# t = res["result_type"]
# if t in [1,3]: sb = ["#{} ".format(res["scalar"])]
# elif t in [2,4]: sb = ["\"{}\"".format(res["string"])]
sb = ["%", self._id," "]
self._update() # fill out _nrows, _ncols, _col_names, _computed
return sb