How to get stacktrace for pandas FutureWarning
Getting stacktraces for pandas future warnings is as easy as converting them to exceptions. Here’s how you can do it:
pandas_stacktrace.py
import warnings
warnings.filterwarnings(
'error', '.*Dtype inference on a pandas object.*',
FutureWarning,
)
Be sure to replace the message filter by whatever message you’re interested in. You can also use regular expressions to match multiple messages.
example.txt
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