本文整理匯總了Python中pandas.compat.ResourceWarning方法的典型用法代碼示例。如果您正苦於以下問題:Python compat.ResourceWarning方法的具體用法?Python compat.ResourceWarning怎麽用?Python compat.ResourceWarning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas.compat
的用法示例。
在下文中一共展示了compat.ResourceWarning方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_invalid_file_not_written
# 需要導入模塊: from pandas import compat [as 別名]
# 或者: from pandas.compat import ResourceWarning [as 別名]
def test_invalid_file_not_written(self, version):
content = 'Here is one __�__ Another one __·__ Another one __½__'
df = DataFrame([content], columns=['invalid'])
expected_exc = UnicodeEncodeError if PY3 else UnicodeDecodeError
with tm.ensure_clean() as path:
msg1 = (r"'latin-1' codec can't encode character '\\ufffd'"
r" in position 14: ordinal not in range\(256\)")
msg2 = ("'ascii' codec can't decode byte 0xef in position 14:"
r" ordinal not in range\(128\)")
with pytest.raises(expected_exc, match=r'{}|{}'.format(
msg1, msg2)):
with tm.assert_produces_warning(ResourceWarning):
df.to_stata(path)