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


Python tables.VLArray方法代码示例

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


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

示例1: _load_sliced_level

# 需要导入模块: import tables [as 别名]
# 或者: from tables import VLArray [as 别名]
def _load_sliced_level(handler, level, sel):
    if isinstance(level, tables.link.SoftLink):
        # this is a link; get target:
        level = level()

    if isinstance(level, tables.VLArray):
        if level.shape == (1,):
            return _load_pickled(level)
        else:
            return level[sel]

    elif isinstance(level, tables.Array):
        return level[sel]

    else:
        raise ValueError('Cannot partially load this data type using `sel`') 
开发者ID:uchicago-cs,项目名称:deepdish,代码行数:18,代码来源:hdf5io.py

示例2: read_array

# 需要导入模块: import tables [as 别名]
# 或者: from tables import VLArray [as 别名]
def read_array(self, key, start=None, stop=None):
        """ read an array for the specified node (off of group """
        import tables
        node = getattr(self.group, key)
        attrs = node._v_attrs

        transposed = getattr(attrs, 'transposed', False)

        if isinstance(node, tables.VLArray):
            ret = node[0][start:stop]
        else:
            dtype = getattr(attrs, 'value_type', None)
            shape = getattr(attrs, 'shape', None)

            if shape is not None:
                # length 0 axis
                ret = np.empty(shape, dtype=dtype)
            else:
                ret = node[start:stop]

            if dtype == u'datetime64':

                # reconstruct a timezone if indicated
                ret = _set_tz(ret, getattr(attrs, 'tz', None), coerce=True)

            elif dtype == u'timedelta64':
                ret = np.asarray(ret, dtype='m8[ns]')

        if transposed:
            return ret.T
        else:
            return ret 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:34,代码来源:pytables.py

示例3: read_array

# 需要导入模块: import tables [as 别名]
# 或者: from tables import VLArray [as 别名]
def read_array(self, key, start=None, stop=None):
        """ read an array for the specified node (off of group """
        import tables
        node = getattr(self.group, key)
        attrs = node._v_attrs

        transposed = getattr(attrs, 'transposed', False)

        if isinstance(node, tables.VLArray):
            ret = node[0][start:stop]
        else:
            dtype = getattr(attrs, 'value_type', None)
            shape = getattr(attrs, 'shape', None)

            if shape is not None:
                # length 0 axis
                ret = np.empty(shape, dtype=dtype)
            else:
                ret = node[start:stop]

            if dtype == u('datetime64'):

                # reconstruct a timezone if indicated
                ret = _set_tz(ret, getattr(attrs, 'tz', None), coerce=True)

            elif dtype == u('timedelta64'):
                ret = np.asarray(ret, dtype='m8[ns]')

        if transposed:
            return ret.T
        else:
            return ret 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:34,代码来源:pytables.py

示例4: read_array

# 需要导入模块: import tables [as 别名]
# 或者: from tables import VLArray [as 别名]
def read_array(self, key):
        """ read an array for the specified node (off of group """
        import tables
        node = getattr(self.group, key)
        data = node[:]
        attrs = node._v_attrs

        transposed = getattr(attrs, 'transposed', False)

        if isinstance(node, tables.VLArray):
            ret = data[0]
        else:
            dtype = getattr(attrs, 'value_type', None)
            shape = getattr(attrs, 'shape', None)

            if shape is not None:
                # length 0 axis
                ret = np.empty(shape, dtype=dtype)
            else:
                ret = data

            if dtype == u('datetime64'):
                ret = np.array(ret, dtype='M8[ns]')
            elif dtype == u('timedelta64'):
                if _np_version_under1p7:
                    raise TypeError(
                        "timedelta64 is not supported under under numpy < 1.7")
                ret = np.array(ret, dtype='m8[ns]')

        if transposed:
            return ret.T
        else:
            return ret 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:35,代码来源:pytables.py

示例5: preprocess

# 需要导入模块: import tables [as 别名]
# 或者: from tables import VLArray [as 别名]
def preprocess(arr, shape):
    if type(arr) is tables.VLArray:
        newarr = VLArrayWrapper(arr, shape)
    if type(arr) is tables.EArray:
        newarr = EArrayWrapper(arr, shape)
    return newarr 
开发者ID:fvisin,项目名称:dataset_loaders,代码行数:8,代码来源:running_stats.py


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