I was attempting to convert all the characters in a Pandas column into strings, in this manner:
df_sample1['county'] = df_sample1['county'].astype(str)
While doing so, I encountered the following error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xc9' in position 38: ordinal not in range(128)
A similar problem has been discussed on Stackoverflow and the suggested solution included "You have to discover in which encoding is this character at the source."
I don't know what encoding my column is in - I was expecting only ASCII Character given that they are county names. Is there a way to find out which characters are the truant ones, and if so, can I convert them all to UTF-8? Or in general, how do I find out what the encoding of the characters is?