Reputation: 21
I loaded a file in a.py using panda:
candidates = pd.read_csv("../train_v1.csv")
model = ........
In b.py, I firstly import the a.py as:
import a as trained_model
Then, I called the model constructed in a.py. The system can't find the file that I loaded in a.py, and gave:
FileNotFoundError: [Errno 2] No such file or directory: '../train_v1.csv'
How should I get this to work?
Upvotes: 0
Views: 78
Reputation: 62
Try to use the aboslute path.
Example your project directory is C:\Test\project\
your file is in the directory C\Test\data\
and called train_v1.csv
then do not use the relative path ../data/train_v1.csv
use C:\Test\data\train_v1.csv
Upvotes: 1