Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (50.2k points)

I'm still kinda new with Python, using Pandas, and I've got some issues debugging my Python script.

I've got the following warning message :

[...]\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)

And can't find where it's from.

After some research, I tried to do that in the Pandas lib file (index.py):

try:

    return self._engine.get_loc(key)

except UnicodeWarning:

    warnings.warn('Oh Non', stacklevel=2)

But that didn't change anything about the warning message.

1 Answer

0 votes
by (108k points)

You can simply filter the warnings to raise which will enable you to debug (e.g. using pdb):

import warnings

warnings.filterwarnings('error')

For more information you can refer the following link:

https://docs.python.org/2/library/warnings.html#the-warnings-filter

If you wish to know What is Python visit this Python Course.

Browse Categories

...