SoFunction
Updated on 2024-12-13

pandas filtering a column with a coding error solution

As shown below:

df = df[df['cityname']==u'Beijing Municipality']

Remember, if you're using python2, be sure to import the

import sys
 
reload(sys)
 
('utf-8')

Or add u' in front of Chinese to indicate unicode encoding, because the Chinese characters in the pandas object are of unicode type.

Above this pandas filtering a column of coding errors in the solution is all that I have shared with you, I hope to give you a reference, and I hope that you will support me more.