3
I’m learning to manipulate files .csv
in Python with the jupyter notebook.
I extracted a file from the system, in csv
, separated by commas, but when I opened I received this error:
arqsb2 = open('arquivos/sb2.csv','r')
sb2 = arqsb2.read()
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-2-084f7ffc9ea2> in <module>()
----> 1 sb2 = arqsb2.read()
C:\ProgramData\Anaconda3\lib\encodings\cp1252.py in decode(self, input, final)
21 class IncrementalDecoder(codecs.IncrementalDecoder):
22 def decode(self, input, final=False):
---> 23 return codecs.charmap_decode(input,self.errors,decoding_table)[0]
24
25 class StreamWriter(Codec,codecs.StreamWriter):
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 1022110: character maps to <undefined>
Could someone help me?
Rafael, in the file opening method, tries to pass the encoding already, something like:
arqsb2 = open('arquivos/sb2.csv',encoding='utf-8','r')
, I fished it out of doc– Tuxpilgrim