import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.graph_objs as go
content = pd.read_csv('https://raw.githubusercontent.com/umsi-data-science/data/main/aranet4.csv')
content
plt.scatter(content["Temperature(°C)"],content["Relative humidity(%)"])
plt.xlabel('Temperature (°C)')
plt.ylabel('Relative humidity (%)')
plt.title('Reltaive Humidity to Temperature')
plt.show()
content.describe()['Atmospheric pressure(hPa)']
plt.boxplot(content['Atmospheric pressure(hPa)'])
plt.annotate("Median (1002 hPa)", xycoords = 'figure pixels', xy=(190, 145), xytext=(65, 140),
arrowprops=dict(facecolor='green', shrink=0.10),
)
plt.annotate("Maximum (1017 hPa)", xycoords = 'figure pixels', xy=(205, 230), xytext=(65, 220),
arrowprops=dict(facecolor='red', shrink=0.10),
)
plt.annotate("Minimum (983 hPa)", xycoords = 'figure pixels', xy=(205, 35), xytext=(65, 30),
arrowprops=dict(facecolor='skyblue', shrink=0.10),
)
plt.ylabel('Atmospheric pressure(hPa)')
plt.title('Box plot of Atmospheric pressure (hPa)')
content
content.Time = pd.to_datetime(content.Time)
content.set_index('Time', inplace=True)
jan20 = content.loc['1/20/2022', :]
jan20
jan20["Carbon dioxide(ppm)"].resample("1H").max().plot()
plt.xlabel('Time (In Hours)')
plt.ylabel('Carbon dioxide(ppm)')
plt.title('Carbon dioxide levels on January 20th, 2022')
jan21 = content.loc['1/21/2022', :]
jan21 = jan21['Carbon dioxide(ppm)']
jan21st = jan21.reset_index()
fig,graph = plt.subplots()
graph.plot(jan21st['Time'],np.ma.masked_where(jan21st['Carbon dioxide(ppm)'] < 1400,jan21st['Carbon dioxide(ppm)']), color = 'r')
graph.plot(jan21st['Time'],np.ma.masked_where((jan21st['Carbon dioxide(ppm)'] > 1000),(jan21st['Carbon dioxide(ppm)'])), color = 'g')
graph.plot(jan21st['Time'],np.ma.masked_where((jan21st['Carbon dioxide(ppm)'] < 1000) | (jan21st['Carbon dioxide(ppm)'] > 1400), jan21st['Carbon dioxide(ppm)']), color = 'orange')
plt.xticks(rotation=90)
plt.xlabel('Time')
plt.ylabel('Carbon dioxide(ppm)')
plt.title('Carbon dioxide levels on January 21st, 2022')
plt.show()