Hi,
I managed to plot data with script below.
But i dont know how to plot time on the X axis.
The print time gives unix time, so that has to be converted to datetime to.
Thanks
I managed to plot data with script below.
But i dont know how to plot time on the X axis.
The print time gives unix time, so that has to be converted to datetime to.
Thanks
import pandas as pd import requests import json import matplotlib.pyplot as plt import numpy as np from datetime import datetime import time url = 'https://api.darksky.net/forecast/1f67baef0ec1a24e097666a982fb/5483143,32984?units=si' response = requests.get(url) weather_data = response.json() time = [weather_data['hourly']['data'][k]['time'] for k in range(0,48)] temperature_min = [weather_data['hourly']['data'][k]['temperature'] for k in range(0,48)] temperature_max = [weather_data['hourly']['data'][k]['dewPoint'] for k in range(0,48)] print(temperature_min) print(time) fig, ax = plt.subplots() ax.plot(time, temperature_min, label='temp') ax.plot(time, temperature_max) ax.grid() plt.show()