Jupyter notebook: No such file or directory whenever I import CVS file

Viewed 38

'''I have already checked the name of the file , but the error still occurred'''

    %matplotlib inline
    import numpy as np
    import pandas as pd
    
    df = pd.read_csv("pasthires.csv")
    df.head()





    FileNotFoundError                         Traceback (most recent call last)
    <ipython-input-1-94f4edd06694> in <module>
          3 import pandas as pd
          4 
    ----> 5 df = pd.read_csv("pasthires.csv")
          6 df.head()
    
    
1 Answers

this looks like you are not in the correct/same folder. You could use

import os
os.path.abspath(os.path.curdir)

to get a look "where" your current working directory is. os.path.join()could than help you to create the correct path to your CSV-file.

Related