當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。