“CSV file does not exist” for a filename with embedded quotes

前端 未结 18 702
萌比男神i
萌比男神i 2020-12-15 23:16

I am currently learning Pandas for data analysis and having some issues reading a csv file in Atom editor.

When I am running the following code:

imp         


        
相关标签:
18条回答
  • 2020-12-15 23:37

    Run "pwd" command first in cli to find out what is your current project's direction and then add the name of the file to your path!

    0 讨论(0)
  • 2020-12-15 23:38

    Make sure your source file is saved in .csv format. I tried all the steps of adding the full path to the file, including and deleting the header=0, adding skiprows=0 but nothing works as I saved the excel file(data file) in workbook format and not in CSV format. so keep in mind to first check your file extension.

    0 讨论(0)
  • 2020-12-15 23:39

    If you get this type of Error

    Then fix the path of the directory

    0 讨论(0)
  • 2020-12-15 23:40

    Being on jupyter notebook it works for me including the relative path only. For example:

    df = pd.read_csv ('file.csv')
    

    But, for example, in vscode I have to put the complete path:

    df = pd.read_csv ('/home/code/file.csv')
    
    0 讨论(0)
  • 2020-12-15 23:41

    Have you tried?

    df = pd.read_csv("Users/alekseinabatov/Documents/Python/FBI-CRIME11.csv")
    

    or maybe

    df = pd.read_csv('Users/alekseinabatov/Documents/Python/"FBI-CRIME11.csv"')
    

    (If the file name has quotes)

    0 讨论(0)
  • 2020-12-15 23:43

    What works for me is

    dataset = pd.read_csv('FBI_CRIME11.csv')
    

    Highlight it and press enter. It also depends on the IDE you are using. I am using Anaconda Spyder or Jupiter.

    0 讨论(0)
提交回复
热议问题