# importing pandas to store the data and view my data
import pandas as pd
# getting the filepath of my dataset
file_path = './London.csv'
london_house_data = pd.read_csv(file_path)
# viewing the data
# london_house_data.head()
london_house_data.describe()
y = london_house_data.Price
features = ['No. of Receptions','Area in sq ft', 'No. of Bedrooms', 'No. of Bathrooms']
X = london_house_data[features]
# making my model
from sklearn.tree import DecisionTreeRegressor
from numpy import array
# the random state ensures i get the same results each run .. or something like that.
model = DecisionTreeRegressor(random_state=1)
model.fit(X, y)
# the test_house with the 4 conditions
test_house = array([[2,700,2,2]])
integer_value = model.predict(test_house)
prediction_value = str(integer_value).strip(".]")
print("The Predicted Price of this house is", prediction_value.replace("[","£"))
The Predicted Price of this house is £675000