0

I am trying to open a csv file with pandas but i get this error:

test_tweets = pd.read_csv(r"C:\Users\22587\Downloads\data\test_tweets.csv")

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 75: invalid start byte
desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • 2
    Does this answer your question? [UnicodeDecodeError: 'utf8' codec can't decode byte 0x9c](https://stackoverflow.com/questions/12468179/unicodedecodeerror-utf8-codec-cant-decode-byte-0x9c) – Juan C Aug 14 '20 at 15:29
  • I can suggest you to check the file and its encoding. Pandas will try to read this file in utf8 encoding but it possible can any other ancondinds. You can pass second argument to your function in that way: `encoding="cp1251"`. List of available encodings https://docs.python.org/3/library/codecs.html#standard-encodings – Stavinsky Aug 14 '20 at 18:21
  • Please also take a look on this question https://stackoverflow.com/questions/18171739/unicodedecodeerror-when-reading-csv-file-in-pandas-with-python – Stavinsky Aug 14 '20 at 18:24

1 Answers1

1

0xa0 is the non breaking space. You maybe copied your data from a website and there was such an invisible character