def load_data(filename: str):
    '\n    Load house prices dataset and preprocess data.\n    Parameters\n    ----------\n    filename: str\n        Path to house prices dataset\n\n    Returns\n    -------\n    Design matrix and response vector (prices) - either as a single\n    DataFrame or a Tuple[DataFrame, Series]\n    '
    df = pd.read_csv(filename)
    df = df.dropna()
    df = df[(df['price'] > 0)]
    df = df[(df['yr_built'] > 0)]
    df = df[(df['bedrooms'] < 20)]
    df['date'] = df['date'].apply((lambda x: int(str(x)[:4])))
    df = df[(df['sqft_living'] <= df['sqft_lot'])]
    labels_to_drop = ['zipcode', 'lat', 'long', 'sqft_living15', 'sqft_lot15']
    df.drop(columns=labels_to_drop, inplace=True)
    series = df.pop('price')
    return (df, series)
Load house prices dataset and preprocess data.
Parameters
----------
filename: str
    Path to house prices dataset

Returns
-------
Design matrix and response vector (prices) - either as a single
DataFrame or a Tuple[DataFrame, Series]
def load_data(filename: str):
    '\n    Load house prices dataset and preprocess data.\n    Parameters\n    ----------\n    filename: str\n        Path to house prices dataset\n\n    Returns\n    -------\n    Design matrix and response vector (prices) - either as a single\n    DataFrame or a Tuple[DataFrame, Series]\n    '
    df = pd.read_csv(filename)
    df = df.dropna()
    df = df[(df['price'] > 0)]
    df = df[(df['yr_built'] > 0)]
    df = df[(df['bedrooms'] < 20)]
    df['date'] = df['date'].apply((lambda x: int(str(x)[:4])))
    df = df[(df['sqft_living'] <= df['sqft_lot'])]
    labels_to_drop = ['zipcode', 'lat', 'long', 'sqft_living15', 'sqft_lot15']
    df.drop(columns=labels_to_drop, inplace=True)
    series = df.pop('price')
    return (df, series)