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


Python parsers.EmptyDataError方法代码示例

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


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

示例1: _create

# 需要导入模块: from pandas.io import parsers [as 别名]
# 或者: from pandas.io.parsers import EmptyDataError [as 别名]
def _create(request, data_type, **kwargs):
    """
    Create instance of desired type, using file in request class.

    :param _pytest.fixtures.FixtureRequest: test case that initiated the
        fixture request that triggered this call
    :param type data_type: the data type to be created
    """
    request_class_attr_name = _ATTR_BY_TYPE[data_type]
    data_source = request_class_attribute(request, request_class_attr_name)
    _LOGGER.debug("Using %s as source of data to build %s",
                  data_source, data_type.__class__.__name__)
    try:
        return data_type(data_source, **kwargs)
    except EmptyDataError:
        with open(data_source, 'r') as datafile:
            _LOGGER.error("File contents:\n{}".format(datafile.readlines()))
        raise 
开发者ID:pepkit,项目名称:peppy,代码行数:20,代码来源:conftest.py

示例2: test_skiprows_inference_empty

# 需要导入模块: from pandas.io import parsers [as 别名]
# 或者: from pandas.io.parsers import EmptyDataError [as 别名]
def test_skiprows_inference_empty():
    data = """
AA   BBB  C
12   345  6
78   901  2
""".strip()

    msg = "No rows from which to infer column width"
    with pytest.raises(EmptyDataError, match=msg):
        read_fwf(StringIO(data), skiprows=3) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:12,代码来源:test_read_fwf.py

示例3: test_skiprows_inference_empty

# 需要导入模块: from pandas.io import parsers [as 别名]
# 或者: from pandas.io.parsers import EmptyDataError [as 别名]
def test_skiprows_inference_empty(self):
        test = """
AA   BBB  C
12   345  6
78   901  2
""".strip()

        with pytest.raises(EmptyDataError):
            read_fwf(StringIO(test), skiprows=3) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:11,代码来源:test_read_fwf.py


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