Jupiter on my laptop would open the file for the project

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

My Code:
newfile = open(“AppleStore.csv”, encoding=‘utf8’ )
from csv import reader
file_cont = reader(newfile)
apl_store_data = list(file_cont)

newfile_g = open(“googleplaystore.csv”, encoding=‘utf8’ )
from csv import reader
file_cont_g = reader(newfile_g)
ggl_store_data = list(file_cont_g)

Replace this line with your code

What I expected to happen:
Open the csv file

What actually happened:
UnicodeDecodeError Traceback (most recent call last)
in
2 from csv import reader
3 file_cont = reader(newfile)
----> 4 apl_store_data = list(file_cont)
5
6 newfile_g = open(“googleplaystore.csv”)

~/opt/anaconda3/lib/python3.8/codecs.py in decode(self, input, final)
320 # decode input (taking the buffer into account)
321 data = self.buffer + input
–> 322 (result, consumed) = self._buffer_decode(data, self.errors, final)
323 # keep undecoded input until the next call
324 self.buffer = data[consumed:]

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd1 in position 8: invalid continuation byte

Replace this line with the output/error

Try using different encodings like 'latin_1' , 'ISO-8859-1' or 'Windows-1251' instead of using 'UTF-8' encoding.

Hope this might solve your error.

Now I get another one:

Error Traceback (most recent call last)
in
2 from csv import reader
3 file_cont = reader(newfile)
----> 4 apl_store_data = list(file_cont)

Error: line contains NUL

maybe there’s something wrong with the data file?

If your trying to open it in Jupyter of your laptop then kindly mention the path where the data file is downloaded.

newfile = open(“Path where the CSV file is stored\File name.csv”, encoding=‘utf8’ )

Note: Remember! While specifying the exact path, characters prefaced by \ (like \n \r \t etc.) are interpreted as special characters. You can escape them using:

  • double backslashes like 'C:\\new\\text.csv'