如何获取 pandas FutureWarning 的堆栈跟踪
获取 pandas 未来警告的堆栈跟踪就像将它们转换为异常一样简单。以下是你可以这样做:
pandas_stacktrace.py
import warnings
warnings.filterwarnings(
'error', '.*Dtype inference on a pandas object.*',
FutureWarning,
)确保将消息过滤器替换为你感兴趣的消息。你还可以使用正则表达式匹配多个消息。
Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow