Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (19.9k points)

Unable to import this file it shows an error. My code was:

import pandas as pd

a = pd.read_csv("filename.csv")

1 Answer

0 votes
by (25.1k points)

You have to use the encoding as latin1 to read this file as there are some special character in this file, use the below code snippet to read the file. Try this:

import pandas as pd

data=pd.read_csv("C:\\Users\\akashkumar\\Downloads\\Customers.csv",encoding='latin1')

print(data.head())

If you want to get a deeper understanding of data science and libraries used in it you can watch this youtube video: 

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...