0 votes
1 view
in Machine Learning by (13.5k 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !