My question is similar to the one in link but with a slight difference
the project structure is
project_folder
--> main.py
--> scripts_folder
--> script.py
--> data_folder
--> data.csv
The main.py looks like this
from scripts_folder.script import a
a()
The script.py looks like this
import pandas as pd
df = pd.read_csv('../data_folder/data.csv')
# do some things with df
def a():
print('something')
I am running main.py
, which calls script.py
, which has to import data from data.csv
.
I tried the method given in the question above. ie I tried importing using this line of code in scripty.py
pd.reac_csv('../data_folder/data.csv')
but it is not working.
It is giving me error
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: '../data_folder/data.csv'
[EDIT]
I tried moving the data.csv
into scripts_folder
as in
project_folder
--> main.py
--> scripts_folder
--> script.py
--> data.csv
--> data_folder (empty)
and I changed it to df = pd.read_csv('data.csv')
and still I am getting the same error
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'data.csv'
Can someone help? Thanks