当前位置: 首页>>代码示例>>Python>>正文


Python Expr.eager方法代码示例

本文整理汇总了Python中expr.Expr.eager方法的典型用法代码示例。如果您正苦于以下问题:Python Expr.eager方法的具体用法?Python Expr.eager怎么用?Python Expr.eager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在expr.Expr的用法示例。


在下文中一共展示了Expr.eager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: row_select

# 需要导入模块: from expr import Expr [as 别名]
# 或者: from expr.Expr import eager [as 别名]
 def row_select(self, vec):
   """
   Boolean column select lookup
   :param vec: An H2OVec.
   :return: A new H2OVec.
   """
   e = Expr("[", self, vec)
   j = h2o.frame(e.eager())
   e.set_len(j['frames'][0]['rows'])
   return H2OVec(self._name, e)
开发者ID:StephaneFeniar,项目名称:h2o-dev,代码行数:12,代码来源:frame.py

示例2: __getitem__

# 需要导入模块: from expr import Expr [as 别名]
# 或者: from expr.Expr import eager [as 别名]
  def __getitem__(self, i):
    """
    Column selection via integer, string(name)
    Column selection via slice returns a subset of the H2OFrame

    :param i: An int, str, slice, H2OVec, or list/tuple
    :return: An H2OVec, an H2OFrame, or scalar depending on the input slice.
    """
    if self._vecs is None or self._vecs == []:
      raise ValueError("Frame Removed")
    if isinstance(i, int):   return self._vecs[i]
    if isinstance(i, str):   return self._find(i)
    # Slice; return a Frame not a Vec
    if isinstance(i, slice): return H2OFrame(vecs=self._vecs[i])
    # Row selection from a boolean Vec
    if isinstance(i, H2OVec):
      self._len_check(i)
      return H2OFrame(vecs=[x.row_select(i) for x in self._vecs])

    # have a list/tuple of numbers or strings
    if isinstance(i, list) or (isinstance(i, tuple) and len(i) != 2):
      vecs = []
      for it in i:
        if isinstance(it, int):    vecs.append(self._vecs[it])
        elif isinstance(it, str):  vecs.append(self._find(it))
        else:                      raise NotImplementedError
      return H2OFrame(vecs=vecs)

    # multi-dimensional slicing via 2-tuple
    if isinstance(i, tuple):
      veckeys = [str(v._expr._data) for v in self._vecs]
      left = Expr(veckeys)
      rite = Expr((i[0], i[1]))
      res = Expr("[", left, rite, length=2)
      if not isinstance(i[0], int) or not isinstance(i[1], int): return res # possible big data
      # small data (single value)
      res.eager()
      if res.is_local(): return res._data
      j = h2o.frame(res._data) # data is remote
      return map(list, zip(*[c['data'] for c in j['frames'][0]['columns'][:]]))[0][0]

    raise NotImplementedError("Slicing by unknown type: "+str(type(i)))
开发者ID:venkatesh12341234,项目名称:h2o-dev,代码行数:44,代码来源:frame.py

示例3: row_select

# 需要导入模块: from expr import Expr [as 别名]
# 或者: from expr.Expr import eager [as 别名]
  def row_select(self, vec):
    """
    Boolean column select lookup

    :param vec: An H2OVec.
    :return: A new H2OVec.
    """
    e = Expr("[", self, vec)
    r = e.eager()
    if isinstance(r, (float,int)):
      e.set_len(1)
    else:
      j = h2o.frame(r)
      e.set_len(j['frames'][0]['rows'])
    return H2OVec(self._name, e)
开发者ID:OspreyX,项目名称:h2o-dev,代码行数:17,代码来源:frame.py


注:本文中的expr.Expr.eager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。