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