Jan-20-2020, 08:38 PM
Hi,
Ive managed to get live data from the web in code below.
Now i try to make a graph from that data.
Im getting data in numbers and when i run the script an empty graph is showing.
I dont know what im doing wrong
Thanks.
Ive managed to get live data from the web in code below.
Now i try to make a graph from that data.
Im getting data in numbers and when i run the script an empty graph is showing.
I dont know what im doing wrong
Thanks.
import matplotlib import matplotlib.pyplot as plt import requests import json import time import numpy as np url = 'https://api.darksky.net/forecast/19322f67baef0exxxxxx/xxx.483143,xxxx.622984' response = requests.get(url) data = response.json() fields = ['time', 'temperature', 'pressure', 'humidity', 'precipProbability'] transformed = [ { field: rec.get(field) for field in fields } for rec in data['hourly']['data'] ] plt.plot('temperature') plt.show() print(json.dumps(transformed, indent=4))