Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Machine Learning by (19k points)

I'm trying to execute a code and I get the following error

SyntaxError: Non-ASCII character '\xe2' in file C:/path/ on line 3, but no encoding declared

import pandas as pd

df = pd.read_csv(“C:\Users\Kamal\Desktop\Desktop\datasets\ex.xls”)

for index, row in df.iterrows():

    print (row['email'])

1 Answer

0 votes
by (33.1k points)
edited by

You should add the following line on top of your python code:

# -*- coding: utf-8 -*-

Also, avoid using non-ASCII quotations.

Hope this answer helps you!

If you want to learn  Python for Data Science then you can watch this Python tutorial. This will eventually help in cracking the Machine Learning Interview Questions.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...