本文整理汇总了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
示例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])
示例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
示例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