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
Timeobject
1/18/2022 9:46:13 PM0%
1/18/2022 9:47:13 PM0%
5771 others100%
Carbon dioxide(ppm)int64
441 - 2263
50
1/18/2022 10:54:13 PM
828
51
1/18/2022 10:56:13 PM
839
52
1/18/2022 10:58:13 PM
847
53
1/18/2022 11:00:13 PM
837
54
1/18/2022 11:02:13 PM
831
55
1/18/2022 11:04:13 PM
848
56
1/18/2022 11:06:13 PM
788
57
1/18/2022 11:08:13 PM
932
58
1/18/2022 11:10:13 PM
832
59
1/18/2022 11:12:13 PM
828
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
Timeobject
1/18/2022 9:46:13 PM0%
1/18/2022 9:47:13 PM0%
5771 others100%
Carbon dioxide(ppm)int64
441 - 2263
30
1/18/2022 10:16:13 PM
839
31
1/18/2022 10:17:13 PM
853
32
1/18/2022 10:18:13 PM
844
33
1/18/2022 10:20:13 PM
841
34
1/18/2022 10:22:13 PM
845
35
1/18/2022 10:24:13 PM
839
36
1/18/2022 10:26:13 PM
853
37
1/18/2022 10:28:13 PM
862
38
1/18/2022 10:30:13 PM
853
39
1/18/2022 10:32:13 PM
859
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()