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


Python tables.__version__方法代码示例

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


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

示例1: _tables

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def _tables():
    global _table_mod
    global _table_file_open_policy_is_strict
    if _table_mod is None:
        import tables
        _table_mod = tables

        # version requirements
        if LooseVersion(tables.__version__) < LooseVersion('3.0.0'):
            raise ImportError("PyTables version >= 3.0.0 is required")

        # set the file open policy
        # return the file open policy; this changes as of pytables 3.1
        # depending on the HDF5 version
        try:
            _table_file_open_policy_is_strict = (
                tables.file._FILE_OPEN_POLICY == 'strict')
        except AttributeError:
            pass

    return _table_mod

# interface to/from ### 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:pytables.py

示例2: _tables

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def _tables():
    global _table_mod
    global _table_file_open_policy_is_strict
    if _table_mod is None:
        import tables
        _table_mod = tables

        # version requirements
        if LooseVersion(tables.__version__) < LooseVersion('3.0.0'):
            raise ImportError("PyTables version >= 3.0.0 is required")

        # set the file open policy
        # return the file open policy; this changes as of pytables 3.1
        # depending on the HDF5 version
        try:
            _table_file_open_policy_is_strict = (
                tables.file._FILE_OPEN_POLICY == 'strict')
        except:
            pass

    return _table_mod

# interface to/from ### 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:25,代码来源:pytables.py

示例3: _tables

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def _tables():
    global _table_mod
    global _table_supports_index
    global _table_file_open_policy_is_strict
    if _table_mod is None:
        import tables
        from distutils.version import LooseVersion
        _table_mod = tables

        # version requirements
        ver = tables.__version__
        _table_supports_index = LooseVersion(ver) >= '2.3'

        # set the file open policy
        # return the file open policy; this changes as of pytables 3.1
        # depending on the HDF5 version
        try:
            _table_file_open_policy_is_strict = tables.file._FILE_OPEN_POLICY == 'strict'
        except:
            pass

    return _table_mod 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:24,代码来源:pytables.py

示例4: test_open_args

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def test_open_args(self):

        with ensure_clean_path(self.path) as path:

            df = tm.makeDataFrame()

            # create an in memory store
            store = HDFStore(path,mode='a',driver='H5FD_CORE',driver_core_backing_store=0)
            store['df'] = df
            store.append('df2',df)

            tm.assert_frame_equal(store['df'],df)
            tm.assert_frame_equal(store['df2'],df)

            store.close()

            # only supported on pytable >= 3.0.0
            if LooseVersion(tables.__version__) >= '3.0.0':

                # the file should not have actually been written
                self.assert_(os.path.exists(path) is False) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:23,代码来源:test_pytables.py

示例5: test_encoding

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def test_encoding(self):

        if LooseVersion(tables.__version__) < '3.0.0':
            raise nose.SkipTest('tables version does not support proper encoding')
        if sys.byteorder != 'little':
            raise nose.SkipTest('system byteorder is not little')

        with ensure_clean_store(self.path) as store:
            df = DataFrame(dict(A='foo',B='bar'),index=range(5))
            df.loc[2,'A'] = np.nan
            df.loc[3,'B'] = np.nan
            _maybe_remove(store, 'df')
            store.append('df', df, encoding='ascii')
            tm.assert_frame_equal(store['df'], df)

            expected = df.reindex(columns=['A'])
            result = store.select('df',Term('columns=A',encoding='ascii'))
            tm.assert_frame_equal(result,expected) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:20,代码来源:test_pytables.py

示例6: test_legacy_table_write

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def test_legacy_table_write(self):
        raise nose.SkipTest("skipping for now")

        store = HDFStore(tm.get_data_path('legacy_hdf/legacy_table_%s.h5' % pandas.__version__), 'a')

        df = tm.makeDataFrame()
        wp = tm.makePanel()

        index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'],
                                   ['one', 'two', 'three']],
                           labels=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3],
                                   [0, 1, 2, 0, 1, 1, 2, 0, 1, 2]],
                           names=['foo', 'bar'])
        df = DataFrame(np.random.randn(10, 3), index=index,
                       columns=['A', 'B', 'C'])
        store.append('mi', df)

        df = DataFrame(dict(A = 'foo', B = 'bar'),index=lrange(10))
        store.append('df', df, data_columns = ['B'], min_itemsize={'A' : 200 })
        store.append('wp', wp)

        store.close() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:24,代码来源:test_pytables.py

示例7: check_pysam_version

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def check_pysam_version(min_pysam_ver="0.8.4"):
    """Checks that the imported version of pysam is greater than
    or equal to provided version. Returns 0 if version is high enough,
    raises ImportWarning otherwise."""
    import pysam

    min_ver = [int(x) for x in min_pysam_ver.split(".")]
    pysam_ver = [int(x) for x in pysam.__version__.split(".")]

    n_ver = min(len(pysam_ver), len(min_pysam_ver))
    
    for i in range(n_ver):
        if pysam_ver[i] < min_ver[i]:
            raise ImportWarning("pysam version is %s, but pysam version %s "
                                "or greater is required" % (pysam.__version__,
                                min_pysam_ver))
        if pysam_ver[i] > min_ver[i]:
            # version like 1.0 beats version like 0.8
            break
        
    return 0 
开发者ID:bmvdgeijn,项目名称:WASP,代码行数:23,代码来源:util.py

示例8: _tables

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def _tables():
    global _table_mod
    global _table_file_open_policy_is_strict
    if _table_mod is None:
        import tables
        _table_mod = tables

        # version requirements
        if LooseVersion(tables.__version__) < '3.0.0':
            raise ImportError("PyTables version >= 3.0.0 is required")

        # set the file open policy
        # return the file open policy; this changes as of pytables 3.1
        # depending on the HDF5 version
        try:
            _table_file_open_policy_is_strict = (
                tables.file._FILE_OPEN_POLICY == 'strict')
        except:
            pass

    return _table_mod

# interface to/from ### 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:25,代码来源:pytables.py

示例9: check_pytables_version

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def check_pytables_version():
    """Checks that PyTables version 3 is being used. PyTables version 3 
    changes the names of many functions and is not backwards compatible
    with PyTables 2. Previous versions of WASP used version 2, but switch
    to version 3 was made at same time as switch to python3."""
    import tables

    pytables_ver = [int(x) for x in tables.__version__.split(".")]

    if pytables_ver[0] < 3:
        raise ImportWarning("pytables version is %s, but pytables version "
                            ">=3 is required" % (tables.__version__))

    return 0 
开发者ID:bmvdgeijn,项目名称:WASP,代码行数:16,代码来源:util.py

示例10: get_length

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def get_length(path):
    if tables.__version__[0] == '2':
        target_table = tables.openFile(path, 'r')
        target_index = target_table.getNode('/indices')
    else:
        target_table = tables.open_file(path, 'r')
        target_index = target_table.get_node('/indices')

    return target_index.shape[0] 
开发者ID:caglar,项目名称:Attentive_reader,代码行数:11,代码来源:rc_data_iter_multi.py

示例11: synchronized_open_file

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def synchronized_open_file(*args, **kwargs):
    if tables.__version__[0] == '2':
        tbf = tables.openFile(*args, **kwargs)
    else:
        tbf = tables.open_file(*args, **kwargs)
    return tbf 
开发者ID:caglar,项目名称:Attentive_reader,代码行数:8,代码来源:rc_data_iter_multi.py

示例12: load_rc_data

# 需要导入模块: import tables [as 别名]
# 或者: from tables import __version__ [as 别名]
def load_rc_data(self):
        driver = None
        if self.can_fit:
            driver = "H5FD_CORE"

        self.started = True
        target_table = synchronized_open_file(self.target_file, 'r',
                                              driver=driver)
        print "Opened the file."

        if tables.__version__[0] == '2':
            self.d_data, self.d_index = (target_table.getNode(self.dtable_name),
                target_table.getNode(self.dindex_name))
            self.q_data, self.q_index = (target_table.getNode(self.qtable_name),
                target_table.getNode(self.qindex_name))
            self.a_data, self.a_index = (target_table.getNode(self.atable_name),
                target_table.getNode(self.aindex_name))
        else:
            self.d_data, self.d_index = (target_table.get_node(self.dtable_name),
                target_table.get_node(self.dindex_name))
            self.q_data, self.q_index = (target_table.get_node(self.qtable_name),
                target_table.get_node(self.qindex_name))
            self.a_data, self.a_index = (target_table.get_node(self.atable_name),
                target_table.get_node(self.aindex_name))

        self.data_len = self.d_index.shape[0]
        if self.stop <= 0:
            self.stop = self.data_len 
开发者ID:caglar,项目名称:Attentive_reader,代码行数:30,代码来源:rc_data_iter.py


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