Forecast: Python
import sys
import pandas
import numpy
import sklearn
# import matplotlib.pyplot as plt
location = "https://ocadu.goodcodeclub.com/temperature/data.csv";
weather = pandas.read_csv(location, header = 0)
weather_filtered = weather[weather["year"] > 2013]
# print(weather_filtered)
x = weather_filtered["monthdayhour"]
y = weather_filtered["DegreeC"]
x = x.values.reshape(-1, 1)
# plt.scatter(x, y, color = "red")
# plt.show()
from sklearn.tree import DecisionTreeRegressor
regressor = DecisionTreeRegressor()
regressor.fit(x, y)
def predict(input):
input = numpy.array([input]).reshape(1,1)
output = regressor.predict(input)
output = output[0]
return output
# print(predict("071312"))
print(predict(sys.argv[1]))
# x_grid = numpy.arange(min(x), max(x))
# x_grid = x_grid.reshape(len(x_grid), 1)
# plt.plot(x_grid, regressor.predict(x_grid), color = "blue")
# plt.show()