Question: How will you write a python code to show a histogram and a line graph(for y axis as outside temperature and day on x axis)

How will you write a python code to show a histogram and a line graph(for y axis as outside temperature and day on x axis) with this code example.

#!pip install faker import json import calendar import numpy as np from pandas import DataFrame import arrow import pandas as pd from faker import Faker from datetime import date import requests import json import sys import os import pyodbc import wx fake = Faker()

#finalData #finalData will be list of element (list of dictionerys(same as data_skeleton)) final_data = [] #noof data required n = 5 no_of_sensor_data = 10 #other data starting_data = date(2015, 1, 15) end_date = date(2020, 12, 5) days = end_date - starting_data series = fake.time_series(start_date='-'+str(days.days + 1)+'d', end_date=str(int(no_of_sensor_data/4)-days.days)+'d', precision=int(6*60*60)) x = [val[0] for val in series] dates = [] times = [] for i in x: dates.append(str(i.year)+"-"+str(i.month)+"-"+str(i.day)) times.append(str(i.hour)+"-"+str(i.minute)+"-"+ str(i.second))

#getting and storing the data in for i in range(n): #prepering sensor data sensor_data = [] for j in range(no_of_sensor_data): OutsideTemperature = fake.random_int(70, 95) OutsideHumidity = fake.random_int(50, 95) sensor_data_skeleton = { "Date":dates[j], "Time":times[j], "Outside Temperature":OutsideTemperature, "Outside Humidity":OutsideHumidity, "Room Temperature":OutsideTemperature - fake.random_int(0, 10), "Room Humidity":OutsideHumidity - fake.random_int(0, 10) } sensor_data.append(sensor_data_skeleton) #getting profile profile = fake.simple_profile() #storing for i th user data_skeleton = { "Firstname":str(profile["name"]).split(" ")[0], "Lastname": fake.last_name(), "age":fake.random_int(0, 100), "gender": profile["sex"], "username": profile["username"], "address":profile["address"], "email": profile["mail"], "sensor_data" : sensor_data } final_data.append(data_skeleton)

final_data

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!