This commit is contained in:
Anton Romanov 2023-04-28 15:07:15 +04:00
parent c28f6de648
commit 7344c2dd3e

View File

@ -101,10 +101,7 @@ url = "http://time-series.athene.tech/api/1.0/getForecast"
headers = {'Content-type': 'application/json'} headers = {'Content-type': 'application/json'}
r = requests.post(url, data=json.dumps(time_series), headers=headers) r = requests.post(url, data=json.dumps(time_series), headers=headers)
forecast = [] forecast = [item['value'] for item in r.json()['timeSeries']['values']]
for v in r.json()['timeSeries']['values']:
forecast.append(v['value'])
forecast = list(filter(lambda a: a !=0, forecast))
plt.plot(range(1, 1+len(source)), source) plt.plot(range(1, 1+len(source)), source)
plt.plot(range(len(source), len(source)+len(forecast)), forecast) plt.plot(range(len(source), len(source)+len(forecast)), forecast)
plt.grid() plt.grid()