简体   繁体   中英

Python: “../DATA/file.csv” no longer working for file opening

Since a while, I have been using the short syntax ('../DAT/file.csv') to get to files under DATA folder. Since this morning, it is not working anymore and I am getting the following error:

FileNotFoundError: [Errno 2] No such file or directory: '../DATA/file.csv'

Any thoughts? Code I am using is below:

Thanks in advance,

df = pd.read_csv('../DATA/moviereviews.csv')

  1. Check if your current directory is the one you expect it to be (ie the one that is beside the DATA directory). You can use the following to do so:
import os
print(os.getcwd())
  1. Check that DATA/moviereviews.csv actually exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM