0

I started moving parts of code outside my jupyter notebooks. I am new in Python and want to make everything right from the beginning. I have a following project structure.

folder structure

Using data/raw/filename obviously doesn't work, I have to go one level up. Like:

with open ('../data/dumps/df_aggregated.dmp', 'rb') as fp:
    df_aggregated = pickle.load(fp)

I think I can save my absolute path to data somewhere in a python script, but I have some doubts if it is right. What if I execute a script/a notebook from a nested folder?

Please help me to understand how to arrange my folders and make it flexible

Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
  • 1
    Does this answer your question? [How to read a (static) file from inside a Python package?](https://stackoverflow.com/questions/6028000/how-to-read-a-static-file-from-inside-a-python-package) – jordanm Dec 03 '20 at 17:27
  • @jordanm sorry, I don't understand how to apply it in my case. Could you explain it more? I don't include data in packages. – diviye3590 Dec 03 '20 at 20:03

0 Answers0