pandas.read_csv FileNotFoundError: File b'\xe2\x80\xaa' despite correct path

前端 未结 13 1287
南笙
南笙 2020-12-15 20:14

I\'m trying to load a .csv file using the pd.read_csv() function when I get an error despite the file path being correct and using raw strings.

13条回答
  •  天命终不由人
    2020-12-15 21:09

    If you are using windows machine. Try checking the file extension. There is a high possibility of file being saved as fileName.csv.txt instead of fileName.csv You can check this by selecting File name extension checkbox under folder options (Please find screenshot)

    below code worked for me:

    import pandas as pd
    df = pd.read_csv(r"C:\Users\vj_sr\Desktop\VJS\PyLearn\DataFiles\weather_data.csv");
    

    If fileName.csv.txt, rename/correct it to fileName.csv

    windows 10 screen shot

    Hope it works, Good Luck

提交回复
热议问题