From 7344c2dd3eda97c9547f387bb2db32287bb83461 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Fri, 28 Apr 2023 15:07:15 +0400 Subject: [PATCH] fix code --- main.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/main.py b/main.py index 9de3f6e..abaf224 100644 --- a/main.py +++ b/main.py @@ -101,10 +101,7 @@ url = "http://time-series.athene.tech/api/1.0/getForecast" headers = {'Content-type': 'application/json'} r = requests.post(url, data=json.dumps(time_series), headers=headers) -forecast = [] -for v in r.json()['timeSeries']['values']: - forecast.append(v['value']) -forecast = list(filter(lambda a: a !=0, forecast)) +forecast = [item['value'] for item in r.json()['timeSeries']['values']] plt.plot(range(1, 1+len(source)), source) plt.plot(range(len(source), len(source)+len(forecast)), forecast) plt.grid()