【发布时间】:2013-06-17 00:15:00
【问题描述】:
我还是个 Python 新手,使用 Pandas,但在调试我的 Python 脚本时遇到了一些问题。
我收到以下警告消息:
[...]\pandas\core\index.py:756: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
return self._engine.get_loc(key)
而且找不到它的来源。
经过一番研究,我尝试在 Pandas lib 文件 (index.py) 中执行此操作:
try:
return self._engine.get_loc(key)
except UnicodeWarning:
warnings.warn('Oh Non', stacklevel=2)
但这并没有改变警告消息的任何内容。
【问题讨论】:
-
我觉得最简单的办法就是强制它升起,然后就可以正常调试了。
标签: python debugging warnings pandas