-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
167 lines (134 loc) · 6.28 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# streamlit_app.py
import streamlit as st
import plotly.express as px
import pandas as pd
from queries import au_stats, queensland_stats_city, queensland_stats_asn, queensland_median_city
# Set up tabs
tab1, tab2, tab3 = st.tabs(["Australia", "Queensland Per City", "Queesnland Per ASN"])
# ---------------- Austrailia ----------------
with tab1:
st.header("Australia Per State")
# Get Data
df = pd.read_csv('data/au_stats.csv')
df_ = df.rename(columns={"state":"State", 'average':'Average Tests Per Day', 'total': 'Total Tests in 2024'})
st.table(df_)
# Total
fig = px.pie(df, values='total', names='state',
title='Total Number of Tests in Australia Per State in 2024')
st.plotly_chart(fig)
#Average
df = df.sort_values(by=['average'], ascending=False)
fig = px.bar(df, x='state', y='average',
title='Average Tests Per Day in Australia Per State in 2024',
color='average')
fig.update_layout(xaxis_title='State', yaxis_title="Average")
st.plotly_chart(fig)
# Get Median Data
df = pd.read_csv('data/au_median.csv')
df_ = df.rename(columns={"state":"State",
'median_download':'Median Download (Mb/s)',
'median_upload': 'Median Upload (Mb/s)',
'testcount': 'Number of Tests'})
st.table(df_)
# Plot Median Download
df = df.sort_values(by=['median_download'], ascending=False)
fig = px.bar(df, x='state', y='median_download',
title='Median Download Per State in Australia in 2024',
color='median_download')
fig.update_layout(xaxis_title='State',
yaxis_title="Median Download (Mb/s)")
fig.update_coloraxes(colorbar_title_text="Mb/s")
st.plotly_chart(fig)
# Plot Median Upload
df = df.sort_values(by=['median_upload'], ascending=False)
fig = px.bar(df, x='state', y='median_upload',
title='Median Upload (Mb/s) Per State in Australia in 2024',
color='median_upload')
fig.update_layout(xaxis_title='State', yaxis_title="Median Upload (Mb/s)")
fig.update_coloraxes(colorbar_title_text="Mb/s")
st.plotly_chart(fig)
# ---------------- Queensland Per City ----------------
with tab2:
st.header("Queensland Per City")
st.subheader("Stats")
# Get Stats Data
df = pd.read_csv('data/queensland_stats_city.csv')
df_ = df.rename(columns={"state":"State", 'average':'Average Tests Per Day', 'total': 'Total Tests in 2024'})
st.table(df_)
# Total
fig = px.pie(df, values='total', names='city', title='Total Number of Tests in Queensland Per City in 2024')
fig.update_traces(textposition='inside')
st.plotly_chart(fig)
#Average
df = df.sort_values(by=['average'], ascending=False)
fig = px.bar(df, x='city', y='average',
title='Average Tests Per Day in Queensland Per City in 2024',
color='average')
fig.update_layout(xaxis_title='City', yaxis_title="Average")
st.plotly_chart(fig)
st.subheader("Median Performance")
# Get Median Data
df = pd.read_csv('data/queensland_median_city.csv')
df_ = df.rename(columns={"city":"City",
'median_download':'Median Download (Mb/s)',
'median_upload': 'Median Upload (Mb/s)',
'testcount': 'Number of Tests'})
st.table(df_)
# Plot Median Download
df = df.sort_values(by=['median_download'], ascending=False)
fig = px.bar(df, x='city', y='median_download',
title='Median Download Per City in Queensland in 2024',
color='median_download')
fig.update_layout(xaxis_title='City', yaxis_title="Median Download (Mb/s)")
fig.update_coloraxes(colorbar_title_text="Mb/s")
st.plotly_chart(fig)
# Plot Median Upload
df = df.sort_values(by=['median_upload'], ascending=False)
fig = px.bar(df, x='city', y='median_upload',
title='Median Upload Per City in Queensland in 2024',
color='median_upload')
fig.update_layout(xaxis_title='City', yaxis_title="Median Upload (Mb/s)")
fig.update_coloraxes(colorbar_title_text="Mb/s")
st.plotly_chart(fig)
# ---------------- Queensland Per ASN ----------------
with tab3:
st.header("Queensland Per Top 10 Autonomous System Name (ASN)")
st.subheader("Stats")
# Get Data
df = pd.read_csv('data/queensland_stats_asn.csv')
df_ = df.rename(columns={"state":"State", 'average':'Average Tests Per Day', 'total': 'Total Tests in 2024'})
st.table(df_)
# Total
fig = px.pie(df, values='total', names='ASName', title='Total Number of Tests in Queensland Per Top 10 ASN in 2024')
st.plotly_chart(fig)
#Average
df = df.sort_values(by=['average'], ascending=False)
fig = px.bar(df, x='ASName', y='average',
title='Average Tests Per Day in Queensland Per Top 10 ASN in 2024',
color='average')
fig.update_layout(xaxis_title='ASN', yaxis_title="Average")
st.plotly_chart(fig)
st.subheader("Median Performance")
# Get Median Data
df = pd.read_csv('data/queensland_median_asn.csv')
df_ = df.rename(columns={"ASName":"ASN",
'median_download':'Median Download (Mb/s)',
'median_upload': 'Median Upload (Mb/s)',
'testcount': 'Number of Tests'})
st.table(df_)
# Plot Median Download
df = df.sort_values(by=['median_download'], ascending=False)
fig = px.bar(df, x='ASName', y='median_download',
title='Median Download Per Top 10 ASN in Queensland in 2024',
color='median_download')
fig.update_layout(xaxis_title='ASN', yaxis_title="Median Download (Mb/s)")
fig.update_coloraxes(colorbar_title_text="Mb/s")
st.plotly_chart(fig)
# Plot Median Upload
df = df.sort_values(by=['median_upload'], ascending=False)
fig = px.bar(df, x='ASName', y='median_upload',
title='Median Upload (Mb/s) Per Top 10 ASN in Queensland in 2024',
color='median_upload')
fig.update_layout(xaxis_title='ASN', yaxis_title="Median Upload (Mb/s)")
fig.update_coloraxes(colorbar_title_text="Mb/s")
st.plotly_chart(fig)