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


Python common._infer_compression方法代码示例

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


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

示例1: test_infer_compression_from_path

# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import _infer_compression [as 别名]
def test_infer_compression_from_path(self, extension, expected, path_type):
        path = path_type('foo/bar.csv' + extension)
        compression = icom._infer_compression(path, compression='infer')
        assert compression == expected 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:6,代码来源:test_common.py

示例2: test_infer_compression_from_path

# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import _infer_compression [as 别名]
def test_infer_compression_from_path(self, extension, expected, path_type):
        path = path_type('foo/bar.csv' + extension)
        compression = common._infer_compression(path, compression='infer')
        assert compression == expected 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:6,代码来源:test_common.py

示例3: to_pickle

# 需要导入模块: from pandas.io import common [as 别名]
# 或者: from pandas.io.common import _infer_compression [as 别名]
def to_pickle(obj, path, compression='infer', protocol=pkl.HIGHEST_PROTOCOL):
    """
    Pickle (serialize) object to input file path

    Parameters
    ----------
    obj : any object
    path : string
        File path
    compression : {'infer', 'gzip', 'bz2', 'xz', None}, default 'infer'
        a string representing the compression to use in the output file

        .. versionadded:: 0.20.0
    protocol : int
        Int which indicates which protocol should be used by the pickler,
        default HIGHEST_PROTOCOL (see [1], paragraph 12.1.2). The possible
        values for this parameter depend on the version of Python. For Python
        2.x, possible values are 0, 1, 2. For Python>=3.0, 3 is a valid value.
        For Python >= 3.4, 4 is a valid value. A negative value for the
        protocol parameter is equivalent to setting its value to
        HIGHEST_PROTOCOL.

        .. [1] https://docs.python.org/3/library/pickle.html
        .. versionadded:: 0.21.0


    """
    path = _stringify_path(path)
    inferred_compression = _infer_compression(path, compression)
    f, fh = _get_handle(path, 'wb',
                        compression=inferred_compression,
                        is_text=False)
    if protocol < 0:
        protocol = pkl.HIGHEST_PROTOCOL
    try:
        pkl.dump(obj, f, protocol=protocol)
    finally:
        for _f in fh:
            _f.close() 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:41,代码来源:pickle.py


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