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


Python converter._WARN属性代码示例

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


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

示例1: test_option_no_warning

# 需要导入模块: from pandas.tseries import converter [as 别名]
# 或者: from pandas.tseries.converter import _WARN [as 别名]
def test_option_no_warning(self):
        pytest.importorskip("matplotlib.pyplot")
        ctx = cf.option_context("plotting.matplotlib.register_converters",
                                False)
        plt = pytest.importorskip("matplotlib.pyplot")
        s = Series(range(12), index=date_range('2017', periods=12))
        _, ax = plt.subplots()

        converter._WARN = True
        # Test without registering first, no warning
        with ctx:
            with tm.assert_produces_warning(None) as w:
                ax.plot(s.index, s.values)

        assert len(w) == 0

        # Now test with registering
        converter._WARN = True
        register_matplotlib_converters()
        with ctx:
            with tm.assert_produces_warning(None) as w:
                ax.plot(s.index, s.values)

        assert len(w) == 0 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:26,代码来源:test_converter.py

示例2: test_warns

# 需要导入模块: from pandas.tseries import converter [as 别名]
# 或者: from pandas.tseries.converter import _WARN [as 别名]
def test_warns(self):
        plt = pytest.importorskip("matplotlib.pyplot")
        s = Series(range(12), index=date_range('2017', periods=12))
        _, ax = plt.subplots()

        # Set to the "warning" state, in case this isn't the first test run
        converter._WARN = True
        with tm.assert_produces_warning(FutureWarning,
                                        check_stacklevel=False) as w:
            ax.plot(s.index, s.values)
            plt.close()

        assert len(w) == 1
        assert "Using an implicitly registered datetime converter" in str(w[0]) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:16,代码来源:test_converter.py

示例3: test_registering_no_warning

# 需要导入模块: from pandas.tseries import converter [as 别名]
# 或者: from pandas.tseries.converter import _WARN [as 别名]
def test_registering_no_warning(self):
        plt = pytest.importorskip("matplotlib.pyplot")
        s = Series(range(12), index=date_range('2017', periods=12))
        _, ax = plt.subplots()

        # Set to the "warn" state, in case this isn't the first test run
        converter._WARN = True
        register_matplotlib_converters()
        with tm.assert_produces_warning(None) as w:
            ax.plot(s.index, s.values)

        assert len(w) == 0 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:14,代码来源:test_converter.py

示例4: test_pandas_plots_register

# 需要导入模块: from pandas.tseries import converter [as 别名]
# 或者: from pandas.tseries.converter import _WARN [as 别名]
def test_pandas_plots_register(self):
        pytest.importorskip("matplotlib.pyplot")
        s = Series(range(12), index=date_range('2017', periods=12))
        # Set to the "warn" state, in case this isn't the first test run
        converter._WARN = True
        with tm.assert_produces_warning(None) as w:
            s.plot()

        assert len(w) == 0 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:11,代码来源:test_converter.py


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