1st Guided Project: UnicodeDecodeError

Screen Link: https://app.dataquest.io/m/350/guided-project%3A-profitable-app-profiles-for-the-app-store-and-google-play-markets/2/opening-and-exploring-the-data

Your Code:

# AppleStore.csv #
from csv import reader

OpenFile1 = open('AppleStore.csv', encoding='utf8')
ReadFile1 = reader(OpenFile1)
AppleData = list(ReadFile1)
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-14-b9412a7d4d30> in <module>
      4 OpenFile1 = open('AppleStore.csv', encoding='utf8')
      5 ReadFile1 = reader(OpenFile)
----> 6 AppleData = list(ReadFile)
      8 #print(AppleData[1:10])

~\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]
     25 class StreamWriter(Codec,codecs.StreamWriter):

UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 6000: character maps to <undefined>

Why do I have to add this encoding argument? Also, I add it like the instructions say and I still get the UnicodeDecodeError. What should I do?

I restarted the kernel and it fixed the error. Not sure why that fixed it? Also can someone still explain to me why I need to add that encoding and other people don’t?

Thank you!

Hopefully this post brings some light to this.

1 Like

Thank you, have a great day!

1 Like