本文整理汇总了Python中pyarrow.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python pyarrow.__version__方法的具体用法?Python pyarrow.__version__怎么用?Python pyarrow.__version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyarrow
的用法示例。
在下文中一共展示了pyarrow.__version__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def __init__(self):
# since pandas is a dependency of pyarrow
# we need to import on first use
try:
import pyarrow
import pyarrow.parquet
except ImportError:
raise ImportError(
"pyarrow is required for parquet support\n\n"
"you can install via conda\n"
"conda install pyarrow -c conda-forge\n"
"\nor via pip\n"
"pip install -U pyarrow\n"
)
if LooseVersion(pyarrow.__version__) < '0.9.0':
raise ImportError(
"pyarrow >= 0.9.0 is required for parquet support\n\n"
"you can install via conda\n"
"conda install pyarrow -c conda-forge\n"
"\nor via pip\n"
"pip install -U pyarrow\n"
)
self.api = pyarrow
示例2: _try_import
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def _try_import():
# since pandas is a dependency of pyarrow
# we need to import on first use
try:
import pyarrow
from pyarrow import feather
except ImportError:
# give a nice error message
raise ImportError("pyarrow is not installed\n\n"
"you can install via conda\n"
"conda install pyarrow -c conda-forge\n"
"or via pip\n"
"pip install -U pyarrow\n")
if LooseVersion(pyarrow.__version__) < LooseVersion('0.9.0'):
raise ImportError("pyarrow >= 0.9.0 required for feather support\n\n"
"you can install via conda\n"
"conda install pyarrow -c conda-forge"
"or via pip\n"
"pip install -U pyarrow\n")
return feather, pyarrow
示例3: __init__
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def __init__(self):
# since pandas is a dependency of fastparquet
# we need to import on first use
try:
import fastparquet
except ImportError:
raise ImportError(
"fastparquet is required for parquet support\n\n"
"you can install via conda\n"
"conda install fastparquet -c conda-forge\n"
"\nor via pip\n"
"pip install -U fastparquet"
)
if LooseVersion(fastparquet.__version__) < '0.1.0':
raise ImportError(
"fastparquet >= 0.1.0 is required for parquet "
"support\n\n"
"you can install via conda\n"
"conda install fastparquet -c conda-forge\n"
"\nor via pip\n"
"pip install -U fastparquet"
)
self.api = fastparquet
示例4: require_minimum_pandas_version
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def require_minimum_pandas_version():
""" Raise ImportError if minimum version of Pandas is not installed
"""
# TODO(HyukjinKwon): Relocate and deduplicate the version specification.
minimum_pandas_version = "0.19.2"
from distutils.version import LooseVersion
try:
import pandas
have_pandas = True
except ImportError:
have_pandas = False
if not have_pandas:
raise ImportError("Pandas >= %s must be installed; however, "
"it was not found." % minimum_pandas_version)
if LooseVersion(pandas.__version__) < LooseVersion(minimum_pandas_version):
raise ImportError("Pandas >= %s must be installed; however, "
"your version was %s." % (minimum_pandas_version, pandas.__version__))
示例5: require_minimum_pyarrow_version
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def require_minimum_pyarrow_version():
""" Raise ImportError if minimum version of pyarrow is not installed
"""
# TODO(HyukjinKwon): Relocate and deduplicate the version specification.
minimum_pyarrow_version = "0.8.0"
from distutils.version import LooseVersion
try:
import pyarrow
have_arrow = True
except ImportError:
have_arrow = False
if not have_arrow:
raise ImportError("PyArrow >= %s must be installed; however, "
"it was not found." % minimum_pyarrow_version)
if LooseVersion(pyarrow.__version__) < LooseVersion(minimum_pyarrow_version):
raise ImportError("PyArrow >= %s must be installed; however, "
"your version was %s." % (minimum_pyarrow_version, pyarrow.__version__))
示例6: assert_pyspark_version
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def assert_pyspark_version():
import logging
pyspark_ver = None
try:
import pyspark
except ImportError:
raise ImportError(
"Unable to import pyspark - consider doing a pip install with [spark] "
"extra to install pyspark with pip"
)
else:
pyspark_ver = getattr(pyspark, "__version__")
if pyspark_ver is None or pyspark_ver < "2.4":
logging.warning(
'Found pyspark version "{}" installed. pyspark>=2.4.0 is recommended.'.format(
pyspark_ver if pyspark_ver is not None else "<unknown version>"
)
)
示例7: __init__
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def __init__(self):
# since pandas is a dependency of pyarrow
# we need to import on first use
try:
import pyarrow
import pyarrow.parquet
except ImportError:
raise ImportError("pyarrow is required for parquet support\n\n"
"you can install via conda\n"
"conda install pyarrow -c conda-forge\n"
"\nor via pip\n"
"pip install -U pyarrow\n")
if LooseVersion(pyarrow.__version__) < '0.4.1':
raise ImportError("pyarrow >= 0.4.1 is required for parquet"
"support\n\n"
"you can install via conda\n"
"conda install pyarrow -c conda-forge\n"
"\nor via pip\n"
"pip install -U pyarrow\n")
self._pyarrow_lt_050 = LooseVersion(pyarrow.__version__) < '0.5.0'
self._pyarrow_lt_060 = LooseVersion(pyarrow.__version__) < '0.6.0'
self.api = pyarrow
示例8: read_feather
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def read_feather(path, columns=None, use_threads=True):
"""
Load a feather-format object from the file path
.. versionadded 0.20.0
Parameters
----------
path : string file path, or file-like object
columns : sequence, default None
If not provided, all columns are read
.. versionadded 0.24.0
nthreads : int, default 1
Number of CPU threads to use when reading to pandas.DataFrame
.. versionadded 0.21.0
.. deprecated 0.24.0
use_threads : bool, default True
Whether to parallelize reading using multiple threads
.. versionadded 0.24.0
Returns
-------
type of object stored in file
"""
feather, pyarrow = _try_import()
path = _stringify_path(path)
if LooseVersion(pyarrow.__version__) < LooseVersion('0.11.0'):
int_use_threads = int(use_threads)
if int_use_threads < 1:
int_use_threads = 1
return feather.read_feather(path, columns=columns,
nthreads=int_use_threads)
return feather.read_feather(path, columns=columns,
use_threads=bool(use_threads))
示例9: _check_arrow_compatibility
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def _check_arrow_compatibility(client_version):
import pyarrow
client_version = tuple(LooseVersion(client_version or pyarrow.__version__).version[:2])
server_version = tuple(LooseVersion(pyarrow.__version__).version[:2])
return client_version == server_version
示例10: _main
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def _main(self):
try:
import pyarrow
self._serial_type = dataserializer.SerialType(options.client.serial_type.lower())
except ImportError:
pyarrow = None
self._serial_type = dataserializer.SerialType.PICKLE
args = self._args.copy()
args['pyver'] = '.'.join(str(v) for v in sys.version_info[:3])
args['pickle_protocol'] = self._pickle_protocol
if pyarrow is not None:
args['arrow_version'] = pyarrow.__version__
if self._session_id is None:
resp = self._req_session.post(self._endpoint + '/api/session', data=args)
if resp.status_code >= 400:
raise SystemError('Failed to create mars session: ' + resp.reason)
else:
resp = self._req_session.get(self._endpoint + '/api/session/' + self._session_id, params=args)
if resp.status_code == 404:
raise ValueError('The session with id = %s doesn\'t exist' % self._session_id)
if resp.status_code >= 400:
raise SystemError('Failed to check mars session.')
content = json.loads(resp.text)
self._session_id = content['session_id']
self._pickle_protocol = content.get('pickle_protocol', pickle.HIGHEST_PROTOCOL)
if not content.get('arrow_compatible'):
self._serial_type = dataserializer.SerialType.PICKLE
示例11: pa_lt_070
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def pa_lt_070():
if not _HAVE_PYARROW:
pytest.skip("pyarrow is not installed")
if LooseVersion(pyarrow.__version__) >= LooseVersion('0.7.0'):
pytest.skip("pyarrow is >= 0.7.0")
return 'pyarrow'
示例12: pa_ge_070
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def pa_ge_070():
if not _HAVE_PYARROW:
pytest.skip("pyarrow is not installed")
if LooseVersion(pyarrow.__version__) < LooseVersion('0.7.0'):
pytest.skip("pyarrow is < 0.7.0")
return 'pyarrow'
示例13: fp_lt_014
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def fp_lt_014():
if not _HAVE_FASTPARQUET:
pytest.skip("fastparquet is not installed")
if LooseVersion(fastparquet.__version__) >= LooseVersion('0.1.4'):
pytest.skip("fastparquet is >= 0.1.4")
return 'fastparquet'
示例14: test_write_index
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def test_write_index(self, engine):
check_names = engine != 'fastparquet'
if engine == 'pyarrow':
import pyarrow
if LooseVersion(pyarrow.__version__) < LooseVersion('0.7.0'):
pytest.skip("pyarrow is < 0.7.0")
df = pd.DataFrame({'A': [1, 2, 3]})
check_round_trip(df, engine)
indexes = [
[2, 3, 4],
pd.date_range('20130101', periods=3),
list('abc'),
[1, 3, 4],
]
# non-default index
for index in indexes:
df.index = index
check_round_trip(df, engine, check_names=check_names)
# index with meta-data
df.index = [0, 1, 2]
df.index.name = 'foo'
check_round_trip(df, engine)
示例15: test_basic
# 需要导入模块: import pyarrow [as 别名]
# 或者: from pyarrow import __version__ [as 别名]
def test_basic(self, pa, df_full):
df = df_full
# additional supported types for pyarrow
import pyarrow
if LooseVersion(pyarrow.__version__) >= LooseVersion('0.7.0'):
df['datetime_tz'] = pd.date_range('20130101', periods=3,
tz='Europe/Brussels')
df['bool_with_none'] = [True, None, True]
check_round_trip(df, pa)