本文整理匯總了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 ###
示例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 ###
示例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
示例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)
示例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)
示例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()
示例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
示例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 ###
示例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
示例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]
示例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
示例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