May-15-2018, 08:34 AM
Hi everyone,
I am having a lot of trouble with setting up paths in my code to pull data from. My most recent problem is with this code below
FileNotFoundError: File b'datasets\\housing\\housing.csv' does not exist
Can anyone help me I want to start modelling on the data but am getting stuck :(
I am having a lot of trouble with setting up paths in my code to pull data from. My most recent problem is with this code below
import os import tarfile from six.moves import urllib DOWNLOAD_ROOT = "https://raw.githubusercontent.com/ageron/handson-ml/master/" HOUSING_PATH = os.path.join("datasets", "housing") HOUSING_URL = DOWNLOAD_ROOT + "datasets/housing/housing.tgz" def fetch_housing_data(housing_url=HOUSING_URL, housing_path=HOUSING_PATH): if not os.path.isdir(housing_path): os.makedirs(housing_path) tgz_path = os.path.join(housing_path, "housing.tgz") urllib.request.urlretrieve(housing_url, tgz_path) housing_tgz = tarfile.open(tgz_path) housing_tgz.extractall(path=housing_path) housing_tgz.close() import pandas as pd def load_housing_data(housing_path=HOUSING_PATH): csv_path = os.path.join(housing_path, "housing.csv") return pd.read_csv(csv_path)I am running the code in spyder and then doing the below code in jupter notebook to try view it.
housing = load_housing_data() housing.head()I get the below error
FileNotFoundError: File b'datasets\\housing\\housing.csv' does not exist
Can anyone help me I want to start modelling on the data but am getting stuck :(