Created
November 29, 2019 03:54
-
-
Save joaopcnogueira/f6979e9d48188c037cadca7f70da96ba to your computer and use it in GitHub Desktop.
How to make Python Code Run Independent of OS Path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Work Directory (/home/user/python_project/): | |
# - data | |
# - data/employee.csv | |
# - src | |
# | |
import os | |
# WORK_DIR="/home/user/python_project/" | |
WORK_DIR = os.getcwd() | |
# DATA_DIR="/home/user/python_project/data" | |
DATA_DIR = os.path.join(WORK_DIR, "data") | |
df = pd.read_csv( os.path.join(DATA_DIR, "employee.csv") ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment