0

I have trouble reading this csv file downloaded from kaggle. I have tried using the utf-8 encoding and it was still not able to read the csv file enter image description here

  • check this: https://stackoverflow.com/questions/18171739/unicodedecodeerror-when-reading-csv-file-in-pandas-with-python – Ade_1 Aug 10 '21 at 03:34
  • Please provide code and error in text form, rather then in image. – imxitiz Aug 11 '21 at 01:37

2 Answers2

1

There might be some special characters in the file.

import pandas as pd
df = pd.read_csv(r"file_path", encoding="latin1")
SmriG6
  • 58
  • 6
0
with open('filename.csv') as file_info:
   print(file_info)

The encoding will be at the end.

data=pd.read_csv('filename.csv', encoding="encoding from file_info")

Works every time.