UnicodeEncoreError

The following :

df = pd.read_csv("C:/Users/Admin/Downloads/file.csv", sep=';', low_memory=False, encoding = 'latin-1')
print(df.columns)

fails to :

ERROR - failed to write data to stream: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='windows-1252'>

I already tried to change the console encoding using https://www.jetbrains.com/pycharm/help/configuring-output-encoding.html :

-Dconsole.encoding=UTF-8 in PYCHARM_HOME/bin/pycharm.exe.vmoptions  

but it doesn't work.

 

The exact same code works perfectly in Spyder.

Thanks for your help

Please sign in to leave a comment.