text: import os
  import tarfile
  import urllib.request
  import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  
  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")
      if not os.path.isfile(tgz_path):
          urllib.request.urlretrieve(housing_url, tgz_path)
          housing_tgz = tarfile.open(tgz_path)
          housing_tgz.extractall(path=housing_path)
          housing_tgz.close()
  
  
  def load_housing_data(housing_path=HOUSING_PATH):
      csv_path = os.path.join(housing_path, "housing.csv")
      return pd.read_csv(csv_path)
  
  
  def split_train_test(data, test_ratio):
      shuffled_indices = np.random.permutation(len(data))
      test_set_size = int(len(data) * test_ratio)
      test_indices = shuffled_indices[:test_set_size]
      train_indices = shuffled_indices[test_set_size:]
      return data.iloc[train_indices], data.iloc[test_indices]
  
  def display_scores(scores):
      print("Scores : ", scores)
      print("Mean : ", scores.mean())
      print("Standard deviation : ", scores.std(), end="\n\n")
  
  
  if __name__=="__main__":
      fetch_housing_data()
      housing = load_housing_data()
  
      print(housing.head())
      print()
      print(housing.info())
      print()
      print(housing["ocean_proximity"].value_counts())
      print()
      print(housing.describe())
  
      housing.hist(bins=50,figsize=(20,15))
      plt.show()
  
  