0π
β
I solved it, what I did was to converted my result to list intead of dataframe and created a list of tuples, then passed it on my jinja file.
Hereβs my python file:
pred_dates = predict_dates(df, days_ahead)
dates_list = [t.strftime("%Y-%m-%d") for t in pred_dates]
forecasted_cases = np.asarray(pred_cases, dtype=np.int64)
forecasted_cases = forecasted_cases.tolist()
forecasted_tuple = [(dates_list[i], forecasted_cases[i])
for i in range(0, len(dates_list))]
return forecasted_tuple
And my controller:
pred_values = forecast.forecast(df, days_ahead, model, time_steps, scaler)
forecasted_tuple = forecast.get_result(df, pred_values, days_ahead, scaler)
labels = [row[0] for row in forecasted_tuple]
values = [row[1] for row in forecasted_tuple]
return render_template("forecast-calculation.html", labels=labels, values=values)
Source:stackexchange.com