当前位置: 首页>>代码示例>>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;未经允许,请勿转载。