當前位置: 首頁>>代碼示例>>Python>>正文


Python common._expand_user方法代碼示例

本文整理匯總了Python中pandas.io.common._expand_user方法的典型用法代碼示例。如果您正苦於以下問題:Python common._expand_user方法的具體用法?Python common._expand_user怎麽用?Python common._expand_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandas.io.common的用法示例。


在下文中一共展示了common._expand_user方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_read_expands_user_home_dir

# 需要導入模塊: from pandas.io import common [as 別名]
# 或者: from pandas.io.common import _expand_user [as 別名]
def test_read_expands_user_home_dir(self, reader, module,
                                        error_class, fn_ext, monkeypatch):
        pytest.importorskip(module)

        path = os.path.join('~', 'does_not_exist.' + fn_ext)
        monkeypatch.setattr(icom, '_expand_user',
                            lambda x: os.path.join('foo', x))

        msg1 = (r"File (b')?.+does_not_exist\.{}'? does not exist"
                .format(fn_ext))
        msg2 = (r"\[Errno 2\] No such file or directory:"
                r" '.+does_not_exist\.{}'").format(fn_ext)
        msg3 = "Unexpected character found when decoding 'false'"
        msg4 = "path_or_buf needs to be a string file path or file-like"
        msg5 = (r"\[Errno 2\] File .+does_not_exist\.{} does not exist:"
                r" '.+does_not_exist\.{}'").format(fn_ext, fn_ext)

        with pytest.raises(error_class, match=r"({}|{}|{}|{}|{})".format(
                msg1, msg2, msg3, msg4, msg5)):
            reader(path) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:22,代碼來源:test_common.py

示例2: test_expand_user

# 需要導入模塊: from pandas.io import common [as 別名]
# 或者: from pandas.io.common import _expand_user [as 別名]
def test_expand_user(self):
        filename = '~/sometest'
        expanded_name = icom._expand_user(filename)

        assert expanded_name != filename
        assert os.path.isabs(expanded_name)
        assert os.path.expanduser(filename) == expanded_name 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:9,代碼來源:test_common.py

示例3: test_expand_user_normal_path

# 需要導入模塊: from pandas.io import common [as 別名]
# 或者: from pandas.io.common import _expand_user [as 別名]
def test_expand_user_normal_path(self):
        filename = '/somefolder/sometest'
        expanded_name = icom._expand_user(filename)

        assert expanded_name == filename
        assert os.path.expanduser(filename) == expanded_name 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:8,代碼來源:test_common.py

示例4: test_expand_user

# 需要導入模塊: from pandas.io import common [as 別名]
# 或者: from pandas.io.common import _expand_user [as 別名]
def test_expand_user(self):
        filename = '~/sometest'
        expanded_name = common._expand_user(filename)

        assert expanded_name != filename
        assert isabs(expanded_name)
        assert os.path.expanduser(filename) == expanded_name 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:9,代碼來源:test_common.py

示例5: test_expand_user_normal_path

# 需要導入模塊: from pandas.io import common [as 別名]
# 或者: from pandas.io.common import _expand_user [as 別名]
def test_expand_user_normal_path(self):
        filename = '/somefolder/sometest'
        expanded_name = common._expand_user(filename)

        assert expanded_name == filename
        assert os.path.expanduser(filename) == expanded_name 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:8,代碼來源:test_common.py

示例6: __init__

# 需要導入模塊: from pandas.io import common [as 別名]
# 或者: from pandas.io.common import _expand_user [as 別名]
def __init__(self, frame, buf=None, columns=None, col_space=None,
                 header=True, index=True, na_rep='NaN', formatters=None,
                 justify=None, float_format=None, sparsify=None,
                 index_names=True, line_width=None, max_rows=None,
                 max_cols=None, show_dimensions=False, decimal='.',
                 table_id=None, render_links=False, **kwds):
        self.frame = frame
        if buf is not None:
            self.buf = _expand_user(_stringify_path(buf))
        else:
            self.buf = StringIO()
        self.show_index_names = index_names

        if sparsify is None:
            sparsify = get_option("display.multi_sparse")

        self.sparsify = sparsify

        self.float_format = float_format
        self.formatters = formatters if formatters is not None else {}
        self.na_rep = na_rep
        self.decimal = decimal
        self.col_space = col_space
        self.header = header
        self.index = index
        self.line_width = line_width
        self.max_rows = max_rows
        self.max_cols = max_cols
        self.max_rows_displayed = min(max_rows or len(self.frame),
                                      len(self.frame))
        self.show_dimensions = show_dimensions
        self.table_id = table_id
        self.render_links = render_links

        if justify is None:
            self.justify = get_option("display.colheader_justify")
        else:
            self.justify = justify

        self.kwds = kwds

        if columns is not None:
            self.columns = ensure_index(columns)
            self.frame = self.frame[self.columns]
        else:
            self.columns = frame.columns

        self._chk_truncate()
        self.adj = _get_adjustment() 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:51,代碼來源:format.py


注:本文中的pandas.io.common._expand_user方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。