Spaces:
Sleeping
Sleeping
tappyness1
commited on
Commit
·
6f8fd55
1
Parent(s):
33f164a
added in heatmap charts
Browse files- app.py +32 -3
- notebooks/Causian_trial1.ipynb +3605 -0
- src/basic_plot.py +2 -2
- src/heatmap.py +139 -0
app.py
CHANGED
@@ -6,10 +6,10 @@ import os
|
|
6 |
from src.basic_plot import basic_chart
|
7 |
from src.map_viz import calling_map_viz
|
8 |
from src.data_ingestion import daily_average
|
|
|
9 |
|
10 |
-
|
11 |
-
def
|
12 |
-
|
13 |
# comment out for local testing, but be sure to include after testing
|
14 |
dataset = load_dataset("tappyness1/causion", use_auth_token=os.environ['TOKEN'])
|
15 |
# print (dataset)
|
@@ -19,7 +19,11 @@ def main():
|
|
19 |
# only use this part before for local testing
|
20 |
# once local testing is completed, comment out and use the dataset above
|
21 |
# counts_df = pd.read_csv("data/counts_dataset.csv")
|
|
|
|
|
|
|
22 |
|
|
|
23 |
# st.set_page_config(layout="wide")
|
24 |
height = 650
|
25 |
|
@@ -34,12 +38,37 @@ def main():
|
|
34 |
st.sidebar.markdown("Select Plots to show")
|
35 |
checkbox_one = st.sidebar.checkbox('Overall Traffic', value = True) # rename as necessary
|
36 |
checkbox_two = st.sidebar.checkbox('Traffic Map', value = True)
|
|
|
37 |
|
38 |
if checkbox_one:
|
39 |
st.plotly_chart(basic_chart(counts_df),use_container_width=True)
|
40 |
|
41 |
if checkbox_two:
|
42 |
st.pyplot(calling_map_viz(counts_df))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
if __name__ == "__main__":
|
45 |
main()
|
|
|
6 |
from src.basic_plot import basic_chart
|
7 |
from src.map_viz import calling_map_viz
|
8 |
from src.data_ingestion import daily_average
|
9 |
+
from src.heatmap import HeatMap
|
10 |
|
11 |
+
@st.cache_data
|
12 |
+
def fetch_data():
|
|
|
13 |
# comment out for local testing, but be sure to include after testing
|
14 |
dataset = load_dataset("tappyness1/causion", use_auth_token=os.environ['TOKEN'])
|
15 |
# print (dataset)
|
|
|
19 |
# only use this part before for local testing
|
20 |
# once local testing is completed, comment out and use the dataset above
|
21 |
# counts_df = pd.read_csv("data/counts_dataset.csv")
|
22 |
+
return counts_df
|
23 |
+
|
24 |
+
def main():
|
25 |
|
26 |
+
counts_df = fetch_data()
|
27 |
# st.set_page_config(layout="wide")
|
28 |
height = 650
|
29 |
|
|
|
38 |
st.sidebar.markdown("Select Plots to show")
|
39 |
checkbox_one = st.sidebar.checkbox('Overall Traffic', value = True) # rename as necessary
|
40 |
checkbox_two = st.sidebar.checkbox('Traffic Map', value = True)
|
41 |
+
checkbox_three = st.sidebar.checkbox('Heat Map', value = True)
|
42 |
|
43 |
if checkbox_one:
|
44 |
st.plotly_chart(basic_chart(counts_df),use_container_width=True)
|
45 |
|
46 |
if checkbox_two:
|
47 |
st.pyplot(calling_map_viz(counts_df))
|
48 |
+
|
49 |
+
if checkbox_three:
|
50 |
+
|
51 |
+
heatmap = HeatMap(counts_df)
|
52 |
+
|
53 |
+
st.plotly_chart(heatmap.vehicle_count_bar())
|
54 |
+
st.plotly_chart(heatmap.heatmap())
|
55 |
+
|
56 |
+
hour_choice = st.selectbox(
|
57 |
+
"Choose Hour",
|
58 |
+
options=[
|
59 |
+
"00:00", "01:00", "02:00", "03:00", "04:00", "05:00",
|
60 |
+
"06:00", "07:00", "08:00", "09:00", "10:00", "11:00",
|
61 |
+
"12:00", "13:00", "14:00", "15:00", "16:00", "17:00",
|
62 |
+
"18:00", "19:00", "20:00", "21:00", "22:00", "23:00",
|
63 |
+
],
|
64 |
+
key = "hour"
|
65 |
+
)
|
66 |
+
st.plotly_chart(heatmap.update_hour_bar_chart(hour_choice))
|
67 |
+
|
68 |
+
day_choice = st.selectbox("Choose Day of the Week", ["Monday", "Tuesday", "Wednesday",
|
69 |
+
"Thursday", "Friday","Saturday", "Sunday"], key = "day")
|
70 |
+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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"id": "258c9132",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": [
|
10 |
+
"import numpy as np\n",
|
11 |
+
"import pandas as pd\n",
|
12 |
+
"import matplotlib.pyplot as plt\n",
|
13 |
+
"import scipy as sp\n",
|
14 |
+
"import sklearn as sk\n",
|
15 |
+
"import datetime\n",
|
16 |
+
"import calendar\n",
|
17 |
+
"from jupyter_dash import JupyterDash\n",
|
18 |
+
"import dash\n",
|
19 |
+
"from dash import Dash, html, dcc, Input, Output\n",
|
20 |
+
"import plotly.express as px\n",
|
21 |
+
"from plotly.subplots import make_subplots\n",
|
22 |
+
"import plotly.graph_objects as go\n",
|
23 |
+
"import requests\n",
|
24 |
+
"import io\n"
|
25 |
+
]
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"cell_type": "code",
|
29 |
+
"execution_count": 2,
|
30 |
+
"id": "e7a1d236",
|
31 |
+
"metadata": {},
|
32 |
+
"outputs": [
|
33 |
+
{
|
34 |
+
"data": {
|
35 |
+
"text/html": [
|
36 |
+
"<div>\n",
|
37 |
+
"<style scoped>\n",
|
38 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
39 |
+
" vertical-align: middle;\n",
|
40 |
+
" }\n",
|
41 |
+
"\n",
|
42 |
+
" .dataframe tbody tr th {\n",
|
43 |
+
" vertical-align: top;\n",
|
44 |
+
" }\n",
|
45 |
+
"\n",
|
46 |
+
" .dataframe thead th {\n",
|
47 |
+
" text-align: right;\n",
|
48 |
+
" }\n",
|
49 |
+
"</style>\n",
|
50 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
51 |
+
" <thead>\n",
|
52 |
+
" <tr style=\"text-align: right;\">\n",
|
53 |
+
" <th></th>\n",
|
54 |
+
" <th>date</th>\n",
|
55 |
+
" <th>time</th>\n",
|
56 |
+
" <th>view</th>\n",
|
57 |
+
" <th>car</th>\n",
|
58 |
+
" <th>motorcycle</th>\n",
|
59 |
+
" <th>large_vehicle</th>\n",
|
60 |
+
" </tr>\n",
|
61 |
+
" </thead>\n",
|
62 |
+
" <tbody>\n",
|
63 |
+
" <tr>\n",
|
64 |
+
" <th>0</th>\n",
|
65 |
+
" <td>2023-02-14</td>\n",
|
66 |
+
" <td>22:36:03</td>\n",
|
67 |
+
" <td>View_from_Second_Link_at_Tuas</td>\n",
|
68 |
+
" <td>0</td>\n",
|
69 |
+
" <td>0</td>\n",
|
70 |
+
" <td>1</td>\n",
|
71 |
+
" </tr>\n",
|
72 |
+
" <tr>\n",
|
73 |
+
" <th>1</th>\n",
|
74 |
+
" <td>2023-02-14</td>\n",
|
75 |
+
" <td>22:36:03</td>\n",
|
76 |
+
" <td>View_from_Tuas_Checkpoint</td>\n",
|
77 |
+
" <td>2</td>\n",
|
78 |
+
" <td>0</td>\n",
|
79 |
+
" <td>0</td>\n",
|
80 |
+
" </tr>\n",
|
81 |
+
" <tr>\n",
|
82 |
+
" <th>2</th>\n",
|
83 |
+
" <td>2023-02-14</td>\n",
|
84 |
+
" <td>22:36:03</td>\n",
|
85 |
+
" <td>View_from_Woodlands_Causeway_Towards_Johor</td>\n",
|
86 |
+
" <td>2</td>\n",
|
87 |
+
" <td>0</td>\n",
|
88 |
+
" <td>0</td>\n",
|
89 |
+
" </tr>\n",
|
90 |
+
" <tr>\n",
|
91 |
+
" <th>3</th>\n",
|
92 |
+
" <td>2023-02-14</td>\n",
|
93 |
+
" <td>22:36:03</td>\n",
|
94 |
+
" <td>View_from_Woodlands_Checkpoint_Towards_BKE</td>\n",
|
95 |
+
" <td>3</td>\n",
|
96 |
+
" <td>0</td>\n",
|
97 |
+
" <td>1</td>\n",
|
98 |
+
" </tr>\n",
|
99 |
+
" <tr>\n",
|
100 |
+
" <th>4</th>\n",
|
101 |
+
" <td>2023-02-14</td>\n",
|
102 |
+
" <td>23:14:34</td>\n",
|
103 |
+
" <td>View_from_Second_Link_at_Tuas</td>\n",
|
104 |
+
" <td>0</td>\n",
|
105 |
+
" <td>0</td>\n",
|
106 |
+
" <td>6</td>\n",
|
107 |
+
" </tr>\n",
|
108 |
+
" </tbody>\n",
|
109 |
+
"</table>\n",
|
110 |
+
"</div>"
|
111 |
+
],
|
112 |
+
"text/plain": [
|
113 |
+
" date time view car \\\n",
|
114 |
+
"0 2023-02-14 22:36:03 View_from_Second_Link_at_Tuas 0 \n",
|
115 |
+
"1 2023-02-14 22:36:03 View_from_Tuas_Checkpoint 2 \n",
|
116 |
+
"2 2023-02-14 22:36:03 View_from_Woodlands_Causeway_Towards_Johor 2 \n",
|
117 |
+
"3 2023-02-14 22:36:03 View_from_Woodlands_Checkpoint_Towards_BKE 3 \n",
|
118 |
+
"4 2023-02-14 23:14:34 View_from_Second_Link_at_Tuas 0 \n",
|
119 |
+
"\n",
|
120 |
+
" motorcycle large_vehicle \n",
|
121 |
+
"0 0 1 \n",
|
122 |
+
"1 0 0 \n",
|
123 |
+
"2 0 0 \n",
|
124 |
+
"3 0 1 \n",
|
125 |
+
"4 0 6 "
|
126 |
+
]
|
127 |
+
},
|
128 |
+
"metadata": {},
|
129 |
+
"output_type": "display_data"
|
130 |
+
},
|
131 |
+
{
|
132 |
+
"name": "stdout",
|
133 |
+
"output_type": "stream",
|
134 |
+
"text": [
|
135 |
+
"(6960, 6)\n"
|
136 |
+
]
|
137 |
+
}
|
138 |
+
],
|
139 |
+
"source": [
|
140 |
+
"url = \"https://raw.githubusercontent.com/tappyness1/causion/main/data/counts_dataset.csv\"\n",
|
141 |
+
"\n",
|
142 |
+
"download = requests.get(url).content\n",
|
143 |
+
"df = pd.read_csv(io.StringIO(download.decode('utf-8')))\n",
|
144 |
+
"display(df.head())\n",
|
145 |
+
"print(df.shape)"
|
146 |
+
]
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"cell_type": "code",
|
150 |
+
"execution_count": 3,
|
151 |
+
"id": "dff31b99",
|
152 |
+
"metadata": {},
|
153 |
+
"outputs": [],
|
154 |
+
"source": [
|
155 |
+
"#Data manipulation\n",
|
156 |
+
"\n",
|
157 |
+
"df['date'] = pd.to_datetime(df['date'], format = \"%Y-%m-%d\")\n",
|
158 |
+
"df['day'] = df['date'].dt.day_name()\n",
|
159 |
+
"df['hour'] = df['time'].str[:2] + ':00'\n",
|
160 |
+
"df.drop(columns=['motorcycle'], axis=1, inplace=True)\n",
|
161 |
+
"df['vehicle'] = df['car'] + df['large_vehicle']"
|
162 |
+
]
|
163 |
+
},
|
164 |
+
{
|
165 |
+
"cell_type": "code",
|
166 |
+
"execution_count": 4,
|
167 |
+
"id": "8545eff0",
|
168 |
+
"metadata": {},
|
169 |
+
"outputs": [
|
170 |
+
{
|
171 |
+
"data": {
|
172 |
+
"text/html": [
|
173 |
+
"<div>\n",
|
174 |
+
"<style scoped>\n",
|
175 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
176 |
+
" vertical-align: middle;\n",
|
177 |
+
" }\n",
|
178 |
+
"\n",
|
179 |
+
" .dataframe tbody tr th {\n",
|
180 |
+
" vertical-align: top;\n",
|
181 |
+
" }\n",
|
182 |
+
"\n",
|
183 |
+
" .dataframe thead th {\n",
|
184 |
+
" text-align: right;\n",
|
185 |
+
" }\n",
|
186 |
+
"</style>\n",
|
187 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
188 |
+
" <thead>\n",
|
189 |
+
" <tr style=\"text-align: right;\">\n",
|
190 |
+
" <th></th>\n",
|
191 |
+
" <th>date</th>\n",
|
192 |
+
" <th>time</th>\n",
|
193 |
+
" <th>view</th>\n",
|
194 |
+
" <th>car</th>\n",
|
195 |
+
" <th>large_vehicle</th>\n",
|
196 |
+
" <th>day</th>\n",
|
197 |
+
" <th>hour</th>\n",
|
198 |
+
" <th>vehicle</th>\n",
|
199 |
+
" </tr>\n",
|
200 |
+
" </thead>\n",
|
201 |
+
" <tbody>\n",
|
202 |
+
" <tr>\n",
|
203 |
+
" <th>0</th>\n",
|
204 |
+
" <td>2023-02-14</td>\n",
|
205 |
+
" <td>22:36:03</td>\n",
|
206 |
+
" <td>View_from_Second_Link_at_Tuas</td>\n",
|
207 |
+
" <td>0</td>\n",
|
208 |
+
" <td>1</td>\n",
|
209 |
+
" <td>Tuesday</td>\n",
|
210 |
+
" <td>22:00</td>\n",
|
211 |
+
" <td>1</td>\n",
|
212 |
+
" </tr>\n",
|
213 |
+
" <tr>\n",
|
214 |
+
" <th>1</th>\n",
|
215 |
+
" <td>2023-02-14</td>\n",
|
216 |
+
" <td>22:36:03</td>\n",
|
217 |
+
" <td>View_from_Tuas_Checkpoint</td>\n",
|
218 |
+
" <td>2</td>\n",
|
219 |
+
" <td>0</td>\n",
|
220 |
+
" <td>Tuesday</td>\n",
|
221 |
+
" <td>22:00</td>\n",
|
222 |
+
" <td>2</td>\n",
|
223 |
+
" </tr>\n",
|
224 |
+
" <tr>\n",
|
225 |
+
" <th>2</th>\n",
|
226 |
+
" <td>2023-02-14</td>\n",
|
227 |
+
" <td>22:36:03</td>\n",
|
228 |
+
" <td>View_from_Woodlands_Causeway_Towards_Johor</td>\n",
|
229 |
+
" <td>2</td>\n",
|
230 |
+
" <td>0</td>\n",
|
231 |
+
" <td>Tuesday</td>\n",
|
232 |
+
" <td>22:00</td>\n",
|
233 |
+
" <td>2</td>\n",
|
234 |
+
" </tr>\n",
|
235 |
+
" <tr>\n",
|
236 |
+
" <th>3</th>\n",
|
237 |
+
" <td>2023-02-14</td>\n",
|
238 |
+
" <td>22:36:03</td>\n",
|
239 |
+
" <td>View_from_Woodlands_Checkpoint_Towards_BKE</td>\n",
|
240 |
+
" <td>3</td>\n",
|
241 |
+
" <td>1</td>\n",
|
242 |
+
" <td>Tuesday</td>\n",
|
243 |
+
" <td>22:00</td>\n",
|
244 |
+
" <td>4</td>\n",
|
245 |
+
" </tr>\n",
|
246 |
+
" <tr>\n",
|
247 |
+
" <th>4</th>\n",
|
248 |
+
" <td>2023-02-14</td>\n",
|
249 |
+
" <td>23:14:34</td>\n",
|
250 |
+
" <td>View_from_Second_Link_at_Tuas</td>\n",
|
251 |
+
" <td>0</td>\n",
|
252 |
+
" <td>6</td>\n",
|
253 |
+
" <td>Tuesday</td>\n",
|
254 |
+
" <td>23:00</td>\n",
|
255 |
+
" <td>6</td>\n",
|
256 |
+
" </tr>\n",
|
257 |
+
" </tbody>\n",
|
258 |
+
"</table>\n",
|
259 |
+
"</div>"
|
260 |
+
],
|
261 |
+
"text/plain": [
|
262 |
+
" date time view car \\\n",
|
263 |
+
"0 2023-02-14 22:36:03 View_from_Second_Link_at_Tuas 0 \n",
|
264 |
+
"1 2023-02-14 22:36:03 View_from_Tuas_Checkpoint 2 \n",
|
265 |
+
"2 2023-02-14 22:36:03 View_from_Woodlands_Causeway_Towards_Johor 2 \n",
|
266 |
+
"3 2023-02-14 22:36:03 View_from_Woodlands_Checkpoint_Towards_BKE 3 \n",
|
267 |
+
"4 2023-02-14 23:14:34 View_from_Second_Link_at_Tuas 0 \n",
|
268 |
+
"\n",
|
269 |
+
" large_vehicle day hour vehicle \n",
|
270 |
+
"0 1 Tuesday 22:00 1 \n",
|
271 |
+
"1 0 Tuesday 22:00 2 \n",
|
272 |
+
"2 0 Tuesday 22:00 2 \n",
|
273 |
+
"3 1 Tuesday 22:00 4 \n",
|
274 |
+
"4 6 Tuesday 23:00 6 "
|
275 |
+
]
|
276 |
+
},
|
277 |
+
"metadata": {},
|
278 |
+
"output_type": "display_data"
|
279 |
+
}
|
280 |
+
],
|
281 |
+
"source": [
|
282 |
+
"display(df.head())"
|
283 |
+
]
|
284 |
+
},
|
285 |
+
{
|
286 |
+
"cell_type": "code",
|
287 |
+
"execution_count": 5,
|
288 |
+
"id": "e567f58d",
|
289 |
+
"metadata": {},
|
290 |
+
"outputs": [
|
291 |
+
{
|
292 |
+
"name": "stderr",
|
293 |
+
"output_type": "stream",
|
294 |
+
"text": [
|
295 |
+
"C:\\Users\\neoce\\AppData\\Local\\Temp\\ipykernel_26408\\1176758689.py:2: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function.\n",
|
296 |
+
" new_df = df.groupby(['day']).sum().reset_index()\n"
|
297 |
+
]
|
298 |
+
},
|
299 |
+
{
|
300 |
+
"data": {
|
301 |
+
"text/html": [
|
302 |
+
"<div>\n",
|
303 |
+
"<style scoped>\n",
|
304 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
305 |
+
" vertical-align: middle;\n",
|
306 |
+
" }\n",
|
307 |
+
"\n",
|
308 |
+
" .dataframe tbody tr th {\n",
|
309 |
+
" vertical-align: top;\n",
|
310 |
+
" }\n",
|
311 |
+
"\n",
|
312 |
+
" .dataframe thead th {\n",
|
313 |
+
" text-align: right;\n",
|
314 |
+
" }\n",
|
315 |
+
"</style>\n",
|
316 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
317 |
+
" <thead>\n",
|
318 |
+
" <tr style=\"text-align: right;\">\n",
|
319 |
+
" <th></th>\n",
|
320 |
+
" <th>day</th>\n",
|
321 |
+
" <th>car</th>\n",
|
322 |
+
" <th>large_vehicle</th>\n",
|
323 |
+
" <th>vehicle</th>\n",
|
324 |
+
" </tr>\n",
|
325 |
+
" </thead>\n",
|
326 |
+
" <tbody>\n",
|
327 |
+
" <tr>\n",
|
328 |
+
" <th>1</th>\n",
|
329 |
+
" <td>Monday</td>\n",
|
330 |
+
" <td>2406</td>\n",
|
331 |
+
" <td>1064</td>\n",
|
332 |
+
" <td>3470</td>\n",
|
333 |
+
" </tr>\n",
|
334 |
+
" <tr>\n",
|
335 |
+
" <th>5</th>\n",
|
336 |
+
" <td>Tuesday</td>\n",
|
337 |
+
" <td>2003</td>\n",
|
338 |
+
" <td>811</td>\n",
|
339 |
+
" <td>2814</td>\n",
|
340 |
+
" </tr>\n",
|
341 |
+
" <tr>\n",
|
342 |
+
" <th>6</th>\n",
|
343 |
+
" <td>Wednesday</td>\n",
|
344 |
+
" <td>1942</td>\n",
|
345 |
+
" <td>864</td>\n",
|
346 |
+
" <td>2806</td>\n",
|
347 |
+
" </tr>\n",
|
348 |
+
" <tr>\n",
|
349 |
+
" <th>4</th>\n",
|
350 |
+
" <td>Thursday</td>\n",
|
351 |
+
" <td>1976</td>\n",
|
352 |
+
" <td>903</td>\n",
|
353 |
+
" <td>2879</td>\n",
|
354 |
+
" </tr>\n",
|
355 |
+
" <tr>\n",
|
356 |
+
" <th>0</th>\n",
|
357 |
+
" <td>Friday</td>\n",
|
358 |
+
" <td>2070</td>\n",
|
359 |
+
" <td>762</td>\n",
|
360 |
+
" <td>2832</td>\n",
|
361 |
+
" </tr>\n",
|
362 |
+
" <tr>\n",
|
363 |
+
" <th>2</th>\n",
|
364 |
+
" <td>Saturday</td>\n",
|
365 |
+
" <td>2117</td>\n",
|
366 |
+
" <td>578</td>\n",
|
367 |
+
" <td>2695</td>\n",
|
368 |
+
" </tr>\n",
|
369 |
+
" <tr>\n",
|
370 |
+
" <th>3</th>\n",
|
371 |
+
" <td>Sunday</td>\n",
|
372 |
+
" <td>1515</td>\n",
|
373 |
+
" <td>428</td>\n",
|
374 |
+
" <td>1943</td>\n",
|
375 |
+
" </tr>\n",
|
376 |
+
" </tbody>\n",
|
377 |
+
"</table>\n",
|
378 |
+
"</div>"
|
379 |
+
],
|
380 |
+
"text/plain": [
|
381 |
+
" day car large_vehicle vehicle\n",
|
382 |
+
"1 Monday 2406 1064 3470\n",
|
383 |
+
"5 Tuesday 2003 811 2814\n",
|
384 |
+
"6 Wednesday 1942 864 2806\n",
|
385 |
+
"4 Thursday 1976 903 2879\n",
|
386 |
+
"0 Friday 2070 762 2832\n",
|
387 |
+
"2 Saturday 2117 578 2695\n",
|
388 |
+
"3 Sunday 1515 428 1943"
|
389 |
+
]
|
390 |
+
},
|
391 |
+
"execution_count": 5,
|
392 |
+
"metadata": {},
|
393 |
+
"output_type": "execute_result"
|
394 |
+
}
|
395 |
+
],
|
396 |
+
"source": [
|
397 |
+
"cat = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday','Saturday', 'Sunday']\n",
|
398 |
+
"new_df = df.groupby(['day']).sum().reset_index()\n",
|
399 |
+
"new_df = new_df.reindex([1,5,6,4,0,2,3])\n",
|
400 |
+
"new_df.head(10)"
|
401 |
+
]
|
402 |
+
},
|
403 |
+
{
|
404 |
+
"cell_type": "code",
|
405 |
+
"execution_count": 6,
|
406 |
+
"id": "b2fc096f",
|
407 |
+
"metadata": {},
|
408 |
+
"outputs": [
|
409 |
+
{
|
410 |
+
"name": "stderr",
|
411 |
+
"output_type": "stream",
|
412 |
+
"text": [
|
413 |
+
"C:\\Users\\neoce\\AppData\\Local\\Temp\\ipykernel_26408\\2911116693.py:1: FutureWarning: The default value of numeric_only in DataFrameGroupBy.sum is deprecated. In a future version, numeric_only will default to False. Either specify numeric_only or select only columns which should be valid for the function.\n",
|
414 |
+
" new = df.groupby(['hour','day']).sum().drop(columns=['car', \"large_vehicle\"]).reset_index()\n"
|
415 |
+
]
|
416 |
+
},
|
417 |
+
{
|
418 |
+
"data": {
|
419 |
+
"text/html": [
|
420 |
+
"<div>\n",
|
421 |
+
"<style scoped>\n",
|
422 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
423 |
+
" vertical-align: middle;\n",
|
424 |
+
" }\n",
|
425 |
+
"\n",
|
426 |
+
" .dataframe tbody tr th {\n",
|
427 |
+
" vertical-align: top;\n",
|
428 |
+
" }\n",
|
429 |
+
"\n",
|
430 |
+
" .dataframe thead th {\n",
|
431 |
+
" text-align: right;\n",
|
432 |
+
" }\n",
|
433 |
+
"</style>\n",
|
434 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
435 |
+
" <thead>\n",
|
436 |
+
" <tr style=\"text-align: right;\">\n",
|
437 |
+
" <th></th>\n",
|
438 |
+
" <th>hour</th>\n",
|
439 |
+
" <th>day</th>\n",
|
440 |
+
" <th>vehicle</th>\n",
|
441 |
+
" </tr>\n",
|
442 |
+
" </thead>\n",
|
443 |
+
" <tbody>\n",
|
444 |
+
" <tr>\n",
|
445 |
+
" <th>0</th>\n",
|
446 |
+
" <td>00:00</td>\n",
|
447 |
+
" <td>Friday</td>\n",
|
448 |
+
" <td>44</td>\n",
|
449 |
+
" </tr>\n",
|
450 |
+
" <tr>\n",
|
451 |
+
" <th>1</th>\n",
|
452 |
+
" <td>00:00</td>\n",
|
453 |
+
" <td>Monday</td>\n",
|
454 |
+
" <td>52</td>\n",
|
455 |
+
" </tr>\n",
|
456 |
+
" <tr>\n",
|
457 |
+
" <th>2</th>\n",
|
458 |
+
" <td>00:00</td>\n",
|
459 |
+
" <td>Saturday</td>\n",
|
460 |
+
" <td>50</td>\n",
|
461 |
+
" </tr>\n",
|
462 |
+
" <tr>\n",
|
463 |
+
" <th>3</th>\n",
|
464 |
+
" <td>00:00</td>\n",
|
465 |
+
" <td>Sunday</td>\n",
|
466 |
+
" <td>61</td>\n",
|
467 |
+
" </tr>\n",
|
468 |
+
" <tr>\n",
|
469 |
+
" <th>4</th>\n",
|
470 |
+
" <td>00:00</td>\n",
|
471 |
+
" <td>Thursday</td>\n",
|
472 |
+
" <td>22</td>\n",
|
473 |
+
" </tr>\n",
|
474 |
+
" <tr>\n",
|
475 |
+
" <th>...</th>\n",
|
476 |
+
" <td>...</td>\n",
|
477 |
+
" <td>...</td>\n",
|
478 |
+
" <td>...</td>\n",
|
479 |
+
" </tr>\n",
|
480 |
+
" <tr>\n",
|
481 |
+
" <th>163</th>\n",
|
482 |
+
" <td>23:00</td>\n",
|
483 |
+
" <td>Saturday</td>\n",
|
484 |
+
" <td>57</td>\n",
|
485 |
+
" </tr>\n",
|
486 |
+
" <tr>\n",
|
487 |
+
" <th>164</th>\n",
|
488 |
+
" <td>23:00</td>\n",
|
489 |
+
" <td>Sunday</td>\n",
|
490 |
+
" <td>62</td>\n",
|
491 |
+
" </tr>\n",
|
492 |
+
" <tr>\n",
|
493 |
+
" <th>165</th>\n",
|
494 |
+
" <td>23:00</td>\n",
|
495 |
+
" <td>Thursday</td>\n",
|
496 |
+
" <td>51</td>\n",
|
497 |
+
" </tr>\n",
|
498 |
+
" <tr>\n",
|
499 |
+
" <th>166</th>\n",
|
500 |
+
" <td>23:00</td>\n",
|
501 |
+
" <td>Tuesday</td>\n",
|
502 |
+
" <td>49</td>\n",
|
503 |
+
" </tr>\n",
|
504 |
+
" <tr>\n",
|
505 |
+
" <th>167</th>\n",
|
506 |
+
" <td>23:00</td>\n",
|
507 |
+
" <td>Wednesday</td>\n",
|
508 |
+
" <td>80</td>\n",
|
509 |
+
" </tr>\n",
|
510 |
+
" </tbody>\n",
|
511 |
+
"</table>\n",
|
512 |
+
"<p>168 rows × 3 columns</p>\n",
|
513 |
+
"</div>"
|
514 |
+
],
|
515 |
+
"text/plain": [
|
516 |
+
" hour day vehicle\n",
|
517 |
+
"0 00:00 Friday 44\n",
|
518 |
+
"1 00:00 Monday 52\n",
|
519 |
+
"2 00:00 Saturday 50\n",
|
520 |
+
"3 00:00 Sunday 61\n",
|
521 |
+
"4 00:00 Thursday 22\n",
|
522 |
+
".. ... ... ...\n",
|
523 |
+
"163 23:00 Saturday 57\n",
|
524 |
+
"164 23:00 Sunday 62\n",
|
525 |
+
"165 23:00 Thursday 51\n",
|
526 |
+
"166 23:00 Tuesday 49\n",
|
527 |
+
"167 23:00 Wednesday 80\n",
|
528 |
+
"\n",
|
529 |
+
"[168 rows x 3 columns]"
|
530 |
+
]
|
531 |
+
},
|
532 |
+
"metadata": {},
|
533 |
+
"output_type": "display_data"
|
534 |
+
}
|
535 |
+
],
|
536 |
+
"source": [
|
537 |
+
"new = df.groupby(['hour','day']).sum().drop(columns=['car', \"large_vehicle\"]).reset_index()\n",
|
538 |
+
"display(new)"
|
539 |
+
]
|
540 |
+
},
|
541 |
+
{
|
542 |
+
"cell_type": "code",
|
543 |
+
"execution_count": 7,
|
544 |
+
"id": "b7d4291c",
|
545 |
+
"metadata": {},
|
546 |
+
"outputs": [
|
547 |
+
{
|
548 |
+
"data": {
|
549 |
+
"text/html": [
|
550 |
+
"<div>\n",
|
551 |
+
"<style scoped>\n",
|
552 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
553 |
+
" vertical-align: middle;\n",
|
554 |
+
" }\n",
|
555 |
+
"\n",
|
556 |
+
" .dataframe tbody tr th {\n",
|
557 |
+
" vertical-align: top;\n",
|
558 |
+
" }\n",
|
559 |
+
"\n",
|
560 |
+
" .dataframe thead th {\n",
|
561 |
+
" text-align: right;\n",
|
562 |
+
" }\n",
|
563 |
+
"</style>\n",
|
564 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
565 |
+
" <thead>\n",
|
566 |
+
" <tr style=\"text-align: right;\">\n",
|
567 |
+
" <th>hour</th>\n",
|
568 |
+
" <th>day</th>\n",
|
569 |
+
" <th>00:00</th>\n",
|
570 |
+
" <th>01:00</th>\n",
|
571 |
+
" <th>02:00</th>\n",
|
572 |
+
" <th>03:00</th>\n",
|
573 |
+
" <th>04:00</th>\n",
|
574 |
+
" <th>05:00</th>\n",
|
575 |
+
" <th>06:00</th>\n",
|
576 |
+
" <th>07:00</th>\n",
|
577 |
+
" <th>08:00</th>\n",
|
578 |
+
" <th>...</th>\n",
|
579 |
+
" <th>14:00</th>\n",
|
580 |
+
" <th>15:00</th>\n",
|
581 |
+
" <th>16:00</th>\n",
|
582 |
+
" <th>17:00</th>\n",
|
583 |
+
" <th>18:00</th>\n",
|
584 |
+
" <th>19:00</th>\n",
|
585 |
+
" <th>20:00</th>\n",
|
586 |
+
" <th>21:00</th>\n",
|
587 |
+
" <th>22:00</th>\n",
|
588 |
+
" <th>23:00</th>\n",
|
589 |
+
" </tr>\n",
|
590 |
+
" </thead>\n",
|
591 |
+
" <tbody>\n",
|
592 |
+
" <tr>\n",
|
593 |
+
" <th>1</th>\n",
|
594 |
+
" <td>Monday</td>\n",
|
595 |
+
" <td>52</td>\n",
|
596 |
+
" <td>82</td>\n",
|
597 |
+
" <td>35</td>\n",
|
598 |
+
" <td>40</td>\n",
|
599 |
+
" <td>29</td>\n",
|
600 |
+
" <td>60</td>\n",
|
601 |
+
" <td>77</td>\n",
|
602 |
+
" <td>233</td>\n",
|
603 |
+
" <td>34</td>\n",
|
604 |
+
" <td>...</td>\n",
|
605 |
+
" <td>268</td>\n",
|
606 |
+
" <td>148</td>\n",
|
607 |
+
" <td>227</td>\n",
|
608 |
+
" <td>253</td>\n",
|
609 |
+
" <td>214</td>\n",
|
610 |
+
" <td>256</td>\n",
|
611 |
+
" <td>69</td>\n",
|
612 |
+
" <td>58</td>\n",
|
613 |
+
" <td>30</td>\n",
|
614 |
+
" <td>35</td>\n",
|
615 |
+
" </tr>\n",
|
616 |
+
" <tr>\n",
|
617 |
+
" <th>5</th>\n",
|
618 |
+
" <td>Tuesday</td>\n",
|
619 |
+
" <td>58</td>\n",
|
620 |
+
" <td>30</td>\n",
|
621 |
+
" <td>19</td>\n",
|
622 |
+
" <td>14</td>\n",
|
623 |
+
" <td>15</td>\n",
|
624 |
+
" <td>35</td>\n",
|
625 |
+
" <td>85</td>\n",
|
626 |
+
" <td>144</td>\n",
|
627 |
+
" <td>47</td>\n",
|
628 |
+
" <td>...</td>\n",
|
629 |
+
" <td>186</td>\n",
|
630 |
+
" <td>202</td>\n",
|
631 |
+
" <td>243</td>\n",
|
632 |
+
" <td>207</td>\n",
|
633 |
+
" <td>265</td>\n",
|
634 |
+
" <td>168</td>\n",
|
635 |
+
" <td>49</td>\n",
|
636 |
+
" <td>40</td>\n",
|
637 |
+
" <td>46</td>\n",
|
638 |
+
" <td>49</td>\n",
|
639 |
+
" </tr>\n",
|
640 |
+
" <tr>\n",
|
641 |
+
" <th>6</th>\n",
|
642 |
+
" <td>Wednesday</td>\n",
|
643 |
+
" <td>28</td>\n",
|
644 |
+
" <td>41</td>\n",
|
645 |
+
" <td>18</td>\n",
|
646 |
+
" <td>17</td>\n",
|
647 |
+
" <td>16</td>\n",
|
648 |
+
" <td>26</td>\n",
|
649 |
+
" <td>57</td>\n",
|
650 |
+
" <td>96</td>\n",
|
651 |
+
" <td>23</td>\n",
|
652 |
+
" <td>...</td>\n",
|
653 |
+
" <td>182</td>\n",
|
654 |
+
" <td>226</td>\n",
|
655 |
+
" <td>192</td>\n",
|
656 |
+
" <td>280</td>\n",
|
657 |
+
" <td>271</td>\n",
|
658 |
+
" <td>163</td>\n",
|
659 |
+
" <td>35</td>\n",
|
660 |
+
" <td>42</td>\n",
|
661 |
+
" <td>32</td>\n",
|
662 |
+
" <td>80</td>\n",
|
663 |
+
" </tr>\n",
|
664 |
+
" <tr>\n",
|
665 |
+
" <th>4</th>\n",
|
666 |
+
" <td>Thursday</td>\n",
|
667 |
+
" <td>22</td>\n",
|
668 |
+
" <td>38</td>\n",
|
669 |
+
" <td>18</td>\n",
|
670 |
+
" <td>18</td>\n",
|
671 |
+
" <td>36</td>\n",
|
672 |
+
" <td>44</td>\n",
|
673 |
+
" <td>75</td>\n",
|
674 |
+
" <td>249</td>\n",
|
675 |
+
" <td>66</td>\n",
|
676 |
+
" <td>...</td>\n",
|
677 |
+
" <td>111</td>\n",
|
678 |
+
" <td>130</td>\n",
|
679 |
+
" <td>197</td>\n",
|
680 |
+
" <td>225</td>\n",
|
681 |
+
" <td>184</td>\n",
|
682 |
+
" <td>163</td>\n",
|
683 |
+
" <td>57</td>\n",
|
684 |
+
" <td>45</td>\n",
|
685 |
+
" <td>45</td>\n",
|
686 |
+
" <td>51</td>\n",
|
687 |
+
" </tr>\n",
|
688 |
+
" <tr>\n",
|
689 |
+
" <th>0</th>\n",
|
690 |
+
" <td>Friday</td>\n",
|
691 |
+
" <td>44</td>\n",
|
692 |
+
" <td>37</td>\n",
|
693 |
+
" <td>31</td>\n",
|
694 |
+
" <td>33</td>\n",
|
695 |
+
" <td>28</td>\n",
|
696 |
+
" <td>36</td>\n",
|
697 |
+
" <td>65</td>\n",
|
698 |
+
" <td>143</td>\n",
|
699 |
+
" <td>0</td>\n",
|
700 |
+
" <td>...</td>\n",
|
701 |
+
" <td>281</td>\n",
|
702 |
+
" <td>245</td>\n",
|
703 |
+
" <td>255</td>\n",
|
704 |
+
" <td>218</td>\n",
|
705 |
+
" <td>215</td>\n",
|
706 |
+
" <td>191</td>\n",
|
707 |
+
" <td>58</td>\n",
|
708 |
+
" <td>45</td>\n",
|
709 |
+
" <td>56</td>\n",
|
710 |
+
" <td>69</td>\n",
|
711 |
+
" </tr>\n",
|
712 |
+
" <tr>\n",
|
713 |
+
" <th>2</th>\n",
|
714 |
+
" <td>Saturday</td>\n",
|
715 |
+
" <td>50</td>\n",
|
716 |
+
" <td>43</td>\n",
|
717 |
+
" <td>24</td>\n",
|
718 |
+
" <td>21</td>\n",
|
719 |
+
" <td>30</td>\n",
|
720 |
+
" <td>48</td>\n",
|
721 |
+
" <td>53</td>\n",
|
722 |
+
" <td>189</td>\n",
|
723 |
+
" <td>37</td>\n",
|
724 |
+
" <td>...</td>\n",
|
725 |
+
" <td>170</td>\n",
|
726 |
+
" <td>214</td>\n",
|
727 |
+
" <td>170</td>\n",
|
728 |
+
" <td>209</td>\n",
|
729 |
+
" <td>271</td>\n",
|
730 |
+
" <td>164</td>\n",
|
731 |
+
" <td>61</td>\n",
|
732 |
+
" <td>54</td>\n",
|
733 |
+
" <td>48</td>\n",
|
734 |
+
" <td>57</td>\n",
|
735 |
+
" </tr>\n",
|
736 |
+
" <tr>\n",
|
737 |
+
" <th>3</th>\n",
|
738 |
+
" <td>Sunday</td>\n",
|
739 |
+
" <td>61</td>\n",
|
740 |
+
" <td>38</td>\n",
|
741 |
+
" <td>16</td>\n",
|
742 |
+
" <td>21</td>\n",
|
743 |
+
" <td>15</td>\n",
|
744 |
+
" <td>28</td>\n",
|
745 |
+
" <td>45</td>\n",
|
746 |
+
" <td>149</td>\n",
|
747 |
+
" <td>4</td>\n",
|
748 |
+
" <td>...</td>\n",
|
749 |
+
" <td>132</td>\n",
|
750 |
+
" <td>100</td>\n",
|
751 |
+
" <td>171</td>\n",
|
752 |
+
" <td>98</td>\n",
|
753 |
+
" <td>96</td>\n",
|
754 |
+
" <td>105</td>\n",
|
755 |
+
" <td>50</td>\n",
|
756 |
+
" <td>50</td>\n",
|
757 |
+
" <td>56</td>\n",
|
758 |
+
" <td>62</td>\n",
|
759 |
+
" </tr>\n",
|
760 |
+
" </tbody>\n",
|
761 |
+
"</table>\n",
|
762 |
+
"<p>7 rows × 25 columns</p>\n",
|
763 |
+
"</div>"
|
764 |
+
],
|
765 |
+
"text/plain": [
|
766 |
+
"hour day 00:00 01:00 02:00 03:00 04:00 05:00 06:00 07:00 \\\n",
|
767 |
+
"1 Monday 52 82 35 40 29 60 77 233 \n",
|
768 |
+
"5 Tuesday 58 30 19 14 15 35 85 144 \n",
|
769 |
+
"6 Wednesday 28 41 18 17 16 26 57 96 \n",
|
770 |
+
"4 Thursday 22 38 18 18 36 44 75 249 \n",
|
771 |
+
"0 Friday 44 37 31 33 28 36 65 143 \n",
|
772 |
+
"2 Saturday 50 43 24 21 30 48 53 189 \n",
|
773 |
+
"3 Sunday 61 38 16 21 15 28 45 149 \n",
|
774 |
+
"\n",
|
775 |
+
"hour 08:00 ... 14:00 15:00 16:00 17:00 18:00 19:00 20:00 21:00 \\\n",
|
776 |
+
"1 34 ... 268 148 227 253 214 256 69 58 \n",
|
777 |
+
"5 47 ... 186 202 243 207 265 168 49 40 \n",
|
778 |
+
"6 23 ... 182 226 192 280 271 163 35 42 \n",
|
779 |
+
"4 66 ... 111 130 197 225 184 163 57 45 \n",
|
780 |
+
"0 0 ... 281 245 255 218 215 191 58 45 \n",
|
781 |
+
"2 37 ... 170 214 170 209 271 164 61 54 \n",
|
782 |
+
"3 4 ... 132 100 171 98 96 105 50 50 \n",
|
783 |
+
"\n",
|
784 |
+
"hour 22:00 23:00 \n",
|
785 |
+
"1 30 35 \n",
|
786 |
+
"5 46 49 \n",
|
787 |
+
"6 32 80 \n",
|
788 |
+
"4 45 51 \n",
|
789 |
+
"0 56 69 \n",
|
790 |
+
"2 48 57 \n",
|
791 |
+
"3 56 62 \n",
|
792 |
+
"\n",
|
793 |
+
"[7 rows x 25 columns]"
|
794 |
+
]
|
795 |
+
},
|
796 |
+
"metadata": {},
|
797 |
+
"output_type": "display_data"
|
798 |
+
}
|
799 |
+
],
|
800 |
+
"source": [
|
801 |
+
"#Pivot the table\n",
|
802 |
+
"\n",
|
803 |
+
"table = pd.pivot_table(new, values='vehicle', index=['day'], columns=['hour']).reset_index()\n",
|
804 |
+
"table = table.reindex([1,5,6,4,0,2,3])\n",
|
805 |
+
"display(table)"
|
806 |
+
]
|
807 |
+
},
|
808 |
+
{
|
809 |
+
"cell_type": "code",
|
810 |
+
"execution_count": 8,
|
811 |
+
"id": "209f0452",
|
812 |
+
"metadata": {},
|
813 |
+
"outputs": [
|
814 |
+
{
|
815 |
+
"data": {
|
816 |
+
"text/html": [
|
817 |
+
"<div>\n",
|
818 |
+
"<style scoped>\n",
|
819 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
820 |
+
" vertical-align: middle;\n",
|
821 |
+
" }\n",
|
822 |
+
"\n",
|
823 |
+
" .dataframe tbody tr th {\n",
|
824 |
+
" vertical-align: top;\n",
|
825 |
+
" }\n",
|
826 |
+
"\n",
|
827 |
+
" .dataframe thead th {\n",
|
828 |
+
" text-align: right;\n",
|
829 |
+
" }\n",
|
830 |
+
"</style>\n",
|
831 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
832 |
+
" <thead>\n",
|
833 |
+
" <tr style=\"text-align: right;\">\n",
|
834 |
+
" <th></th>\n",
|
835 |
+
" <th>hour</th>\n",
|
836 |
+
" <th>Monday</th>\n",
|
837 |
+
" <th>Tuesday</th>\n",
|
838 |
+
" <th>Wednesday</th>\n",
|
839 |
+
" <th>Thursday</th>\n",
|
840 |
+
" <th>Friday</th>\n",
|
841 |
+
" <th>Saturday</th>\n",
|
842 |
+
" <th>Sunday</th>\n",
|
843 |
+
" </tr>\n",
|
844 |
+
" </thead>\n",
|
845 |
+
" <tbody>\n",
|
846 |
+
" <tr>\n",
|
847 |
+
" <th>0</th>\n",
|
848 |
+
" <td>00:00</td>\n",
|
849 |
+
" <td>52</td>\n",
|
850 |
+
" <td>58</td>\n",
|
851 |
+
" <td>28</td>\n",
|
852 |
+
" <td>22</td>\n",
|
853 |
+
" <td>44</td>\n",
|
854 |
+
" <td>50</td>\n",
|
855 |
+
" <td>61</td>\n",
|
856 |
+
" </tr>\n",
|
857 |
+
" <tr>\n",
|
858 |
+
" <th>1</th>\n",
|
859 |
+
" <td>01:00</td>\n",
|
860 |
+
" <td>82</td>\n",
|
861 |
+
" <td>30</td>\n",
|
862 |
+
" <td>41</td>\n",
|
863 |
+
" <td>38</td>\n",
|
864 |
+
" <td>37</td>\n",
|
865 |
+
" <td>43</td>\n",
|
866 |
+
" <td>38</td>\n",
|
867 |
+
" </tr>\n",
|
868 |
+
" <tr>\n",
|
869 |
+
" <th>2</th>\n",
|
870 |
+
" <td>02:00</td>\n",
|
871 |
+
" <td>35</td>\n",
|
872 |
+
" <td>19</td>\n",
|
873 |
+
" <td>18</td>\n",
|
874 |
+
" <td>18</td>\n",
|
875 |
+
" <td>31</td>\n",
|
876 |
+
" <td>24</td>\n",
|
877 |
+
" <td>16</td>\n",
|
878 |
+
" </tr>\n",
|
879 |
+
" <tr>\n",
|
880 |
+
" <th>3</th>\n",
|
881 |
+
" <td>03:00</td>\n",
|
882 |
+
" <td>40</td>\n",
|
883 |
+
" <td>14</td>\n",
|
884 |
+
" <td>17</td>\n",
|
885 |
+
" <td>18</td>\n",
|
886 |
+
" <td>33</td>\n",
|
887 |
+
" <td>21</td>\n",
|
888 |
+
" <td>21</td>\n",
|
889 |
+
" </tr>\n",
|
890 |
+
" <tr>\n",
|
891 |
+
" <th>4</th>\n",
|
892 |
+
" <td>04:00</td>\n",
|
893 |
+
" <td>29</td>\n",
|
894 |
+
" <td>15</td>\n",
|
895 |
+
" <td>16</td>\n",
|
896 |
+
" <td>36</td>\n",
|
897 |
+
" <td>28</td>\n",
|
898 |
+
" <td>30</td>\n",
|
899 |
+
" <td>15</td>\n",
|
900 |
+
" </tr>\n",
|
901 |
+
" </tbody>\n",
|
902 |
+
"</table>\n",
|
903 |
+
"</div>"
|
904 |
+
],
|
905 |
+
"text/plain": [
|
906 |
+
" hour Monday Tuesday Wednesday Thursday Friday Saturday Sunday\n",
|
907 |
+
"0 00:00 52 58 28 22 44 50 61\n",
|
908 |
+
"1 01:00 82 30 41 38 37 43 38\n",
|
909 |
+
"2 02:00 35 19 18 18 31 24 16\n",
|
910 |
+
"3 03:00 40 14 17 18 33 21 21\n",
|
911 |
+
"4 04:00 29 15 16 36 28 30 15"
|
912 |
+
]
|
913 |
+
},
|
914 |
+
"metadata": {},
|
915 |
+
"output_type": "display_data"
|
916 |
+
}
|
917 |
+
],
|
918 |
+
"source": [
|
919 |
+
"t = table.T\n",
|
920 |
+
"t.drop('day', inplace=True)\n",
|
921 |
+
"t.columns = [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\",\n",
|
922 |
+
" \"Saturday\", \"Sunday\"]\n",
|
923 |
+
"t = t.reset_index()\n",
|
924 |
+
"display(t.head())"
|
925 |
+
]
|
926 |
+
},
|
927 |
+
{
|
928 |
+
"cell_type": "code",
|
929 |
+
"execution_count": 9,
|
930 |
+
"id": "5c88c289",
|
931 |
+
"metadata": {},
|
932 |
+
"outputs": [
|
933 |
+
{
|
934 |
+
"data": {
|
935 |
+
"application/vnd.plotly.v1+json": {
|
936 |
+
"config": {
|
937 |
+
"plotlyServerURL": "https://plot.ly"
|
938 |
+
},
|
939 |
+
"data": [
|
940 |
+
{
|
941 |
+
"alignmentgroup": "True",
|
942 |
+
"hovertemplate": "Day of the Week=%{x}<br>Vehicle Count=%{y}<extra></extra>",
|
943 |
+
"legendgroup": "Monday",
|
944 |
+
"marker": {
|
945 |
+
"color": "#636efa",
|
946 |
+
"pattern": {
|
947 |
+
"shape": ""
|
948 |
+
}
|
949 |
+
},
|
950 |
+
"name": "Monday",
|
951 |
+
"offsetgroup": "Monday",
|
952 |
+
"orientation": "v",
|
953 |
+
"showlegend": true,
|
954 |
+
"textposition": "auto",
|
955 |
+
"texttemplate": "%{y}",
|
956 |
+
"type": "bar",
|
957 |
+
"x": [
|
958 |
+
"Monday"
|
959 |
+
],
|
960 |
+
"xaxis": "x",
|
961 |
+
"y": [
|
962 |
+
3470
|
963 |
+
],
|
964 |
+
"yaxis": "y"
|
965 |
+
},
|
966 |
+
{
|
967 |
+
"alignmentgroup": "True",
|
968 |
+
"hovertemplate": "Day of the Week=%{x}<br>Vehicle Count=%{y}<extra></extra>",
|
969 |
+
"legendgroup": "Tuesday",
|
970 |
+
"marker": {
|
971 |
+
"color": "#EF553B",
|
972 |
+
"pattern": {
|
973 |
+
"shape": ""
|
974 |
+
}
|
975 |
+
},
|
976 |
+
"name": "Tuesday",
|
977 |
+
"offsetgroup": "Tuesday",
|
978 |
+
"orientation": "v",
|
979 |
+
"showlegend": true,
|
980 |
+
"textposition": "auto",
|
981 |
+
"texttemplate": "%{y}",
|
982 |
+
"type": "bar",
|
983 |
+
"x": [
|
984 |
+
"Tuesday"
|
985 |
+
],
|
986 |
+
"xaxis": "x",
|
987 |
+
"y": [
|
988 |
+
2814
|
989 |
+
],
|
990 |
+
"yaxis": "y"
|
991 |
+
},
|
992 |
+
{
|
993 |
+
"alignmentgroup": "True",
|
994 |
+
"hovertemplate": "Day of the Week=%{x}<br>Vehicle Count=%{y}<extra></extra>",
|
995 |
+
"legendgroup": "Wednesday",
|
996 |
+
"marker": {
|
997 |
+
"color": "#00cc96",
|
998 |
+
"pattern": {
|
999 |
+
"shape": ""
|
1000 |
+
}
|
1001 |
+
},
|
1002 |
+
"name": "Wednesday",
|
1003 |
+
"offsetgroup": "Wednesday",
|
1004 |
+
"orientation": "v",
|
1005 |
+
"showlegend": true,
|
1006 |
+
"textposition": "auto",
|
1007 |
+
"texttemplate": "%{y}",
|
1008 |
+
"type": "bar",
|
1009 |
+
"x": [
|
1010 |
+
"Wednesday"
|
1011 |
+
],
|
1012 |
+
"xaxis": "x",
|
1013 |
+
"y": [
|
1014 |
+
2806
|
1015 |
+
],
|
1016 |
+
"yaxis": "y"
|
1017 |
+
},
|
1018 |
+
{
|
1019 |
+
"alignmentgroup": "True",
|
1020 |
+
"hovertemplate": "Day of the Week=%{x}<br>Vehicle Count=%{y}<extra></extra>",
|
1021 |
+
"legendgroup": "Thursday",
|
1022 |
+
"marker": {
|
1023 |
+
"color": "#ab63fa",
|
1024 |
+
"pattern": {
|
1025 |
+
"shape": ""
|
1026 |
+
}
|
1027 |
+
},
|
1028 |
+
"name": "Thursday",
|
1029 |
+
"offsetgroup": "Thursday",
|
1030 |
+
"orientation": "v",
|
1031 |
+
"showlegend": true,
|
1032 |
+
"textposition": "auto",
|
1033 |
+
"texttemplate": "%{y}",
|
1034 |
+
"type": "bar",
|
1035 |
+
"x": [
|
1036 |
+
"Thursday"
|
1037 |
+
],
|
1038 |
+
"xaxis": "x",
|
1039 |
+
"y": [
|
1040 |
+
2879
|
1041 |
+
],
|
1042 |
+
"yaxis": "y"
|
1043 |
+
},
|
1044 |
+
{
|
1045 |
+
"alignmentgroup": "True",
|
1046 |
+
"hovertemplate": "Day of the Week=%{x}<br>Vehicle Count=%{y}<extra></extra>",
|
1047 |
+
"legendgroup": "Friday",
|
1048 |
+
"marker": {
|
1049 |
+
"color": "#FFA15A",
|
1050 |
+
"pattern": {
|
1051 |
+
"shape": ""
|
1052 |
+
}
|
1053 |
+
},
|
1054 |
+
"name": "Friday",
|
1055 |
+
"offsetgroup": "Friday",
|
1056 |
+
"orientation": "v",
|
1057 |
+
"showlegend": true,
|
1058 |
+
"textposition": "auto",
|
1059 |
+
"texttemplate": "%{y}",
|
1060 |
+
"type": "bar",
|
1061 |
+
"x": [
|
1062 |
+
"Friday"
|
1063 |
+
],
|
1064 |
+
"xaxis": "x",
|
1065 |
+
"y": [
|
1066 |
+
2832
|
1067 |
+
],
|
1068 |
+
"yaxis": "y"
|
1069 |
+
},
|
1070 |
+
{
|
1071 |
+
"alignmentgroup": "True",
|
1072 |
+
"hovertemplate": "Day of the Week=%{x}<br>Vehicle Count=%{y}<extra></extra>",
|
1073 |
+
"legendgroup": "Saturday",
|
1074 |
+
"marker": {
|
1075 |
+
"color": "#19d3f3",
|
1076 |
+
"pattern": {
|
1077 |
+
"shape": ""
|
1078 |
+
}
|
1079 |
+
},
|
1080 |
+
"name": "Saturday",
|
1081 |
+
"offsetgroup": "Saturday",
|
1082 |
+
"orientation": "v",
|
1083 |
+
"showlegend": true,
|
1084 |
+
"textposition": "auto",
|
1085 |
+
"texttemplate": "%{y}",
|
1086 |
+
"type": "bar",
|
1087 |
+
"x": [
|
1088 |
+
"Saturday"
|
1089 |
+
],
|
1090 |
+
"xaxis": "x",
|
1091 |
+
"y": [
|
1092 |
+
2695
|
1093 |
+
],
|
1094 |
+
"yaxis": "y"
|
1095 |
+
},
|
1096 |
+
{
|
1097 |
+
"alignmentgroup": "True",
|
1098 |
+
"hovertemplate": "Day of the Week=%{x}<br>Vehicle Count=%{y}<extra></extra>",
|
1099 |
+
"legendgroup": "Sunday",
|
1100 |
+
"marker": {
|
1101 |
+
"color": "#FF6692",
|
1102 |
+
"pattern": {
|
1103 |
+
"shape": ""
|
1104 |
+
}
|
1105 |
+
},
|
1106 |
+
"name": "Sunday",
|
1107 |
+
"offsetgroup": "Sunday",
|
1108 |
+
"orientation": "v",
|
1109 |
+
"showlegend": true,
|
1110 |
+
"textposition": "auto",
|
1111 |
+
"texttemplate": "%{y}",
|
1112 |
+
"type": "bar",
|
1113 |
+
"x": [
|
1114 |
+
"Sunday"
|
1115 |
+
],
|
1116 |
+
"xaxis": "x",
|
1117 |
+
"y": [
|
1118 |
+
1943
|
1119 |
+
],
|
1120 |
+
"yaxis": "y"
|
1121 |
+
}
|
1122 |
+
],
|
1123 |
+
"layout": {
|
1124 |
+
"barmode": "relative",
|
1125 |
+
"legend": {
|
1126 |
+
"title": {
|
1127 |
+
"text": "Day of the Week"
|
1128 |
+
},
|
1129 |
+
"tracegroupgap": 0
|
1130 |
+
},
|
1131 |
+
"margin": {
|
1132 |
+
"t": 60
|
1133 |
+
},
|
1134 |
+
"template": {
|
1135 |
+
"data": {
|
1136 |
+
"bar": [
|
1137 |
+
{
|
1138 |
+
"error_x": {
|
1139 |
+
"color": "#2a3f5f"
|
1140 |
+
},
|
1141 |
+
"error_y": {
|
1142 |
+
"color": "#2a3f5f"
|
1143 |
+
},
|
1144 |
+
"marker": {
|
1145 |
+
"line": {
|
1146 |
+
"color": "#E5ECF6",
|
1147 |
+
"width": 0.5
|
1148 |
+
},
|
1149 |
+
"pattern": {
|
1150 |
+
"fillmode": "overlay",
|
1151 |
+
"size": 10,
|
1152 |
+
"solidity": 0.2
|
1153 |
+
}
|
1154 |
+
},
|
1155 |
+
"type": "bar"
|
1156 |
+
}
|
1157 |
+
],
|
1158 |
+
"barpolar": [
|
1159 |
+
{
|
1160 |
+
"marker": {
|
1161 |
+
"line": {
|
1162 |
+
"color": "#E5ECF6",
|
1163 |
+
"width": 0.5
|
1164 |
+
},
|
1165 |
+
"pattern": {
|
1166 |
+
"fillmode": "overlay",
|
1167 |
+
"size": 10,
|
1168 |
+
"solidity": 0.2
|
1169 |
+
}
|
1170 |
+
},
|
1171 |
+
"type": "barpolar"
|
1172 |
+
}
|
1173 |
+
],
|
1174 |
+
"carpet": [
|
1175 |
+
{
|
1176 |
+
"aaxis": {
|
1177 |
+
"endlinecolor": "#2a3f5f",
|
1178 |
+
"gridcolor": "white",
|
1179 |
+
"linecolor": "white",
|
1180 |
+
"minorgridcolor": "white",
|
1181 |
+
"startlinecolor": "#2a3f5f"
|
1182 |
+
},
|
1183 |
+
"baxis": {
|
1184 |
+
"endlinecolor": "#2a3f5f",
|
1185 |
+
"gridcolor": "white",
|
1186 |
+
"linecolor": "white",
|
1187 |
+
"minorgridcolor": "white",
|
1188 |
+
"startlinecolor": "#2a3f5f"
|
1189 |
+
},
|
1190 |
+
"type": "carpet"
|
1191 |
+
}
|
1192 |
+
],
|
1193 |
+
"choropleth": [
|
1194 |
+
{
|
1195 |
+
"colorbar": {
|
1196 |
+
"outlinewidth": 0,
|
1197 |
+
"ticks": ""
|
1198 |
+
},
|
1199 |
+
"type": "choropleth"
|
1200 |
+
}
|
1201 |
+
],
|
1202 |
+
"contour": [
|
1203 |
+
{
|
1204 |
+
"colorbar": {
|
1205 |
+
"outlinewidth": 0,
|
1206 |
+
"ticks": ""
|
1207 |
+
},
|
1208 |
+
"colorscale": [
|
1209 |
+
[
|
1210 |
+
0,
|
1211 |
+
"#0d0887"
|
1212 |
+
],
|
1213 |
+
[
|
1214 |
+
0.1111111111111111,
|
1215 |
+
"#46039f"
|
1216 |
+
],
|
1217 |
+
[
|
1218 |
+
0.2222222222222222,
|
1219 |
+
"#7201a8"
|
1220 |
+
],
|
1221 |
+
[
|
1222 |
+
0.3333333333333333,
|
1223 |
+
"#9c179e"
|
1224 |
+
],
|
1225 |
+
[
|
1226 |
+
0.4444444444444444,
|
1227 |
+
"#bd3786"
|
1228 |
+
],
|
1229 |
+
[
|
1230 |
+
0.5555555555555556,
|
1231 |
+
"#d8576b"
|
1232 |
+
],
|
1233 |
+
[
|
1234 |
+
0.6666666666666666,
|
1235 |
+
"#ed7953"
|
1236 |
+
],
|
1237 |
+
[
|
1238 |
+
0.7777777777777778,
|
1239 |
+
"#fb9f3a"
|
1240 |
+
],
|
1241 |
+
[
|
1242 |
+
0.8888888888888888,
|
1243 |
+
"#fdca26"
|
1244 |
+
],
|
1245 |
+
[
|
1246 |
+
1,
|
1247 |
+
"#f0f921"
|
1248 |
+
]
|
1249 |
+
],
|
1250 |
+
"type": "contour"
|
1251 |
+
}
|
1252 |
+
],
|
1253 |
+
"contourcarpet": [
|
1254 |
+
{
|
1255 |
+
"colorbar": {
|
1256 |
+
"outlinewidth": 0,
|
1257 |
+
"ticks": ""
|
1258 |
+
},
|
1259 |
+
"type": "contourcarpet"
|
1260 |
+
}
|
1261 |
+
],
|
1262 |
+
"heatmap": [
|
1263 |
+
{
|
1264 |
+
"colorbar": {
|
1265 |
+
"outlinewidth": 0,
|
1266 |
+
"ticks": ""
|
1267 |
+
},
|
1268 |
+
"colorscale": [
|
1269 |
+
[
|
1270 |
+
0,
|
1271 |
+
"#0d0887"
|
1272 |
+
],
|
1273 |
+
[
|
1274 |
+
0.1111111111111111,
|
1275 |
+
"#46039f"
|
1276 |
+
],
|
1277 |
+
[
|
1278 |
+
0.2222222222222222,
|
1279 |
+
"#7201a8"
|
1280 |
+
],
|
1281 |
+
[
|
1282 |
+
0.3333333333333333,
|
1283 |
+
"#9c179e"
|
1284 |
+
],
|
1285 |
+
[
|
1286 |
+
0.4444444444444444,
|
1287 |
+
"#bd3786"
|
1288 |
+
],
|
1289 |
+
[
|
1290 |
+
0.5555555555555556,
|
1291 |
+
"#d8576b"
|
1292 |
+
],
|
1293 |
+
[
|
1294 |
+
0.6666666666666666,
|
1295 |
+
"#ed7953"
|
1296 |
+
],
|
1297 |
+
[
|
1298 |
+
0.7777777777777778,
|
1299 |
+
"#fb9f3a"
|
1300 |
+
],
|
1301 |
+
[
|
1302 |
+
0.8888888888888888,
|
1303 |
+
"#fdca26"
|
1304 |
+
],
|
1305 |
+
[
|
1306 |
+
1,
|
1307 |
+
"#f0f921"
|
1308 |
+
]
|
1309 |
+
],
|
1310 |
+
"type": "heatmap"
|
1311 |
+
}
|
1312 |
+
],
|
1313 |
+
"heatmapgl": [
|
1314 |
+
{
|
1315 |
+
"colorbar": {
|
1316 |
+
"outlinewidth": 0,
|
1317 |
+
"ticks": ""
|
1318 |
+
},
|
1319 |
+
"colorscale": [
|
1320 |
+
[
|
1321 |
+
0,
|
1322 |
+
"#0d0887"
|
1323 |
+
],
|
1324 |
+
[
|
1325 |
+
0.1111111111111111,
|
1326 |
+
"#46039f"
|
1327 |
+
],
|
1328 |
+
[
|
1329 |
+
0.2222222222222222,
|
1330 |
+
"#7201a8"
|
1331 |
+
],
|
1332 |
+
[
|
1333 |
+
0.3333333333333333,
|
1334 |
+
"#9c179e"
|
1335 |
+
],
|
1336 |
+
[
|
1337 |
+
0.4444444444444444,
|
1338 |
+
"#bd3786"
|
1339 |
+
],
|
1340 |
+
[
|
1341 |
+
0.5555555555555556,
|
1342 |
+
"#d8576b"
|
1343 |
+
],
|
1344 |
+
[
|
1345 |
+
0.6666666666666666,
|
1346 |
+
"#ed7953"
|
1347 |
+
],
|
1348 |
+
[
|
1349 |
+
0.7777777777777778,
|
1350 |
+
"#fb9f3a"
|
1351 |
+
],
|
1352 |
+
[
|
1353 |
+
0.8888888888888888,
|
1354 |
+
"#fdca26"
|
1355 |
+
],
|
1356 |
+
[
|
1357 |
+
1,
|
1358 |
+
"#f0f921"
|
1359 |
+
]
|
1360 |
+
],
|
1361 |
+
"type": "heatmapgl"
|
1362 |
+
}
|
1363 |
+
],
|
1364 |
+
"histogram": [
|
1365 |
+
{
|
1366 |
+
"marker": {
|
1367 |
+
"pattern": {
|
1368 |
+
"fillmode": "overlay",
|
1369 |
+
"size": 10,
|
1370 |
+
"solidity": 0.2
|
1371 |
+
}
|
1372 |
+
},
|
1373 |
+
"type": "histogram"
|
1374 |
+
}
|
1375 |
+
],
|
1376 |
+
"histogram2d": [
|
1377 |
+
{
|
1378 |
+
"colorbar": {
|
1379 |
+
"outlinewidth": 0,
|
1380 |
+
"ticks": ""
|
1381 |
+
},
|
1382 |
+
"colorscale": [
|
1383 |
+
[
|
1384 |
+
0,
|
1385 |
+
"#0d0887"
|
1386 |
+
],
|
1387 |
+
[
|
1388 |
+
0.1111111111111111,
|
1389 |
+
"#46039f"
|
1390 |
+
],
|
1391 |
+
[
|
1392 |
+
0.2222222222222222,
|
1393 |
+
"#7201a8"
|
1394 |
+
],
|
1395 |
+
[
|
1396 |
+
0.3333333333333333,
|
1397 |
+
"#9c179e"
|
1398 |
+
],
|
1399 |
+
[
|
1400 |
+
0.4444444444444444,
|
1401 |
+
"#bd3786"
|
1402 |
+
],
|
1403 |
+
[
|
1404 |
+
0.5555555555555556,
|
1405 |
+
"#d8576b"
|
1406 |
+
],
|
1407 |
+
[
|
1408 |
+
0.6666666666666666,
|
1409 |
+
"#ed7953"
|
1410 |
+
],
|
1411 |
+
[
|
1412 |
+
0.7777777777777778,
|
1413 |
+
"#fb9f3a"
|
1414 |
+
],
|
1415 |
+
[
|
1416 |
+
0.8888888888888888,
|
1417 |
+
"#fdca26"
|
1418 |
+
],
|
1419 |
+
[
|
1420 |
+
1,
|
1421 |
+
"#f0f921"
|
1422 |
+
]
|
1423 |
+
],
|
1424 |
+
"type": "histogram2d"
|
1425 |
+
}
|
1426 |
+
],
|
1427 |
+
"histogram2dcontour": [
|
1428 |
+
{
|
1429 |
+
"colorbar": {
|
1430 |
+
"outlinewidth": 0,
|
1431 |
+
"ticks": ""
|
1432 |
+
},
|
1433 |
+
"colorscale": [
|
1434 |
+
[
|
1435 |
+
0,
|
1436 |
+
"#0d0887"
|
1437 |
+
],
|
1438 |
+
[
|
1439 |
+
0.1111111111111111,
|
1440 |
+
"#46039f"
|
1441 |
+
],
|
1442 |
+
[
|
1443 |
+
0.2222222222222222,
|
1444 |
+
"#7201a8"
|
1445 |
+
],
|
1446 |
+
[
|
1447 |
+
0.3333333333333333,
|
1448 |
+
"#9c179e"
|
1449 |
+
],
|
1450 |
+
[
|
1451 |
+
0.4444444444444444,
|
1452 |
+
"#bd3786"
|
1453 |
+
],
|
1454 |
+
[
|
1455 |
+
0.5555555555555556,
|
1456 |
+
"#d8576b"
|
1457 |
+
],
|
1458 |
+
[
|
1459 |
+
0.6666666666666666,
|
1460 |
+
"#ed7953"
|
1461 |
+
],
|
1462 |
+
[
|
1463 |
+
0.7777777777777778,
|
1464 |
+
"#fb9f3a"
|
1465 |
+
],
|
1466 |
+
[
|
1467 |
+
0.8888888888888888,
|
1468 |
+
"#fdca26"
|
1469 |
+
],
|
1470 |
+
[
|
1471 |
+
1,
|
1472 |
+
"#f0f921"
|
1473 |
+
]
|
1474 |
+
],
|
1475 |
+
"type": "histogram2dcontour"
|
1476 |
+
}
|
1477 |
+
],
|
1478 |
+
"mesh3d": [
|
1479 |
+
{
|
1480 |
+
"colorbar": {
|
1481 |
+
"outlinewidth": 0,
|
1482 |
+
"ticks": ""
|
1483 |
+
},
|
1484 |
+
"type": "mesh3d"
|
1485 |
+
}
|
1486 |
+
],
|
1487 |
+
"parcoords": [
|
1488 |
+
{
|
1489 |
+
"line": {
|
1490 |
+
"colorbar": {
|
1491 |
+
"outlinewidth": 0,
|
1492 |
+
"ticks": ""
|
1493 |
+
}
|
1494 |
+
},
|
1495 |
+
"type": "parcoords"
|
1496 |
+
}
|
1497 |
+
],
|
1498 |
+
"pie": [
|
1499 |
+
{
|
1500 |
+
"automargin": true,
|
1501 |
+
"type": "pie"
|
1502 |
+
}
|
1503 |
+
],
|
1504 |
+
"scatter": [
|
1505 |
+
{
|
1506 |
+
"fillpattern": {
|
1507 |
+
"fillmode": "overlay",
|
1508 |
+
"size": 10,
|
1509 |
+
"solidity": 0.2
|
1510 |
+
},
|
1511 |
+
"type": "scatter"
|
1512 |
+
}
|
1513 |
+
],
|
1514 |
+
"scatter3d": [
|
1515 |
+
{
|
1516 |
+
"line": {
|
1517 |
+
"colorbar": {
|
1518 |
+
"outlinewidth": 0,
|
1519 |
+
"ticks": ""
|
1520 |
+
}
|
1521 |
+
},
|
1522 |
+
"marker": {
|
1523 |
+
"colorbar": {
|
1524 |
+
"outlinewidth": 0,
|
1525 |
+
"ticks": ""
|
1526 |
+
}
|
1527 |
+
},
|
1528 |
+
"type": "scatter3d"
|
1529 |
+
}
|
1530 |
+
],
|
1531 |
+
"scattercarpet": [
|
1532 |
+
{
|
1533 |
+
"marker": {
|
1534 |
+
"colorbar": {
|
1535 |
+
"outlinewidth": 0,
|
1536 |
+
"ticks": ""
|
1537 |
+
}
|
1538 |
+
},
|
1539 |
+
"type": "scattercarpet"
|
1540 |
+
}
|
1541 |
+
],
|
1542 |
+
"scattergeo": [
|
1543 |
+
{
|
1544 |
+
"marker": {
|
1545 |
+
"colorbar": {
|
1546 |
+
"outlinewidth": 0,
|
1547 |
+
"ticks": ""
|
1548 |
+
}
|
1549 |
+
},
|
1550 |
+
"type": "scattergeo"
|
1551 |
+
}
|
1552 |
+
],
|
1553 |
+
"scattergl": [
|
1554 |
+
{
|
1555 |
+
"marker": {
|
1556 |
+
"colorbar": {
|
1557 |
+
"outlinewidth": 0,
|
1558 |
+
"ticks": ""
|
1559 |
+
}
|
1560 |
+
},
|
1561 |
+
"type": "scattergl"
|
1562 |
+
}
|
1563 |
+
],
|
1564 |
+
"scattermapbox": [
|
1565 |
+
{
|
1566 |
+
"marker": {
|
1567 |
+
"colorbar": {
|
1568 |
+
"outlinewidth": 0,
|
1569 |
+
"ticks": ""
|
1570 |
+
}
|
1571 |
+
},
|
1572 |
+
"type": "scattermapbox"
|
1573 |
+
}
|
1574 |
+
],
|
1575 |
+
"scatterpolar": [
|
1576 |
+
{
|
1577 |
+
"marker": {
|
1578 |
+
"colorbar": {
|
1579 |
+
"outlinewidth": 0,
|
1580 |
+
"ticks": ""
|
1581 |
+
}
|
1582 |
+
},
|
1583 |
+
"type": "scatterpolar"
|
1584 |
+
}
|
1585 |
+
],
|
1586 |
+
"scatterpolargl": [
|
1587 |
+
{
|
1588 |
+
"marker": {
|
1589 |
+
"colorbar": {
|
1590 |
+
"outlinewidth": 0,
|
1591 |
+
"ticks": ""
|
1592 |
+
}
|
1593 |
+
},
|
1594 |
+
"type": "scatterpolargl"
|
1595 |
+
}
|
1596 |
+
],
|
1597 |
+
"scatterternary": [
|
1598 |
+
{
|
1599 |
+
"marker": {
|
1600 |
+
"colorbar": {
|
1601 |
+
"outlinewidth": 0,
|
1602 |
+
"ticks": ""
|
1603 |
+
}
|
1604 |
+
},
|
1605 |
+
"type": "scatterternary"
|
1606 |
+
}
|
1607 |
+
],
|
1608 |
+
"surface": [
|
1609 |
+
{
|
1610 |
+
"colorbar": {
|
1611 |
+
"outlinewidth": 0,
|
1612 |
+
"ticks": ""
|
1613 |
+
},
|
1614 |
+
"colorscale": [
|
1615 |
+
[
|
1616 |
+
0,
|
1617 |
+
"#0d0887"
|
1618 |
+
],
|
1619 |
+
[
|
1620 |
+
0.1111111111111111,
|
1621 |
+
"#46039f"
|
1622 |
+
],
|
1623 |
+
[
|
1624 |
+
0.2222222222222222,
|
1625 |
+
"#7201a8"
|
1626 |
+
],
|
1627 |
+
[
|
1628 |
+
0.3333333333333333,
|
1629 |
+
"#9c179e"
|
1630 |
+
],
|
1631 |
+
[
|
1632 |
+
0.4444444444444444,
|
1633 |
+
"#bd3786"
|
1634 |
+
],
|
1635 |
+
[
|
1636 |
+
0.5555555555555556,
|
1637 |
+
"#d8576b"
|
1638 |
+
],
|
1639 |
+
[
|
1640 |
+
0.6666666666666666,
|
1641 |
+
"#ed7953"
|
1642 |
+
],
|
1643 |
+
[
|
1644 |
+
0.7777777777777778,
|
1645 |
+
"#fb9f3a"
|
1646 |
+
],
|
1647 |
+
[
|
1648 |
+
0.8888888888888888,
|
1649 |
+
"#fdca26"
|
1650 |
+
],
|
1651 |
+
[
|
1652 |
+
1,
|
1653 |
+
"#f0f921"
|
1654 |
+
]
|
1655 |
+
],
|
1656 |
+
"type": "surface"
|
1657 |
+
}
|
1658 |
+
],
|
1659 |
+
"table": [
|
1660 |
+
{
|
1661 |
+
"cells": {
|
1662 |
+
"fill": {
|
1663 |
+
"color": "#EBF0F8"
|
1664 |
+
},
|
1665 |
+
"line": {
|
1666 |
+
"color": "white"
|
1667 |
+
}
|
1668 |
+
},
|
1669 |
+
"header": {
|
1670 |
+
"fill": {
|
1671 |
+
"color": "#C8D4E3"
|
1672 |
+
},
|
1673 |
+
"line": {
|
1674 |
+
"color": "white"
|
1675 |
+
}
|
1676 |
+
},
|
1677 |
+
"type": "table"
|
1678 |
+
}
|
1679 |
+
]
|
1680 |
+
},
|
1681 |
+
"layout": {
|
1682 |
+
"annotationdefaults": {
|
1683 |
+
"arrowcolor": "#2a3f5f",
|
1684 |
+
"arrowhead": 0,
|
1685 |
+
"arrowwidth": 1
|
1686 |
+
},
|
1687 |
+
"autotypenumbers": "strict",
|
1688 |
+
"coloraxis": {
|
1689 |
+
"colorbar": {
|
1690 |
+
"outlinewidth": 0,
|
1691 |
+
"ticks": ""
|
1692 |
+
}
|
1693 |
+
},
|
1694 |
+
"colorscale": {
|
1695 |
+
"diverging": [
|
1696 |
+
[
|
1697 |
+
0,
|
1698 |
+
"#8e0152"
|
1699 |
+
],
|
1700 |
+
[
|
1701 |
+
0.1,
|
1702 |
+
"#c51b7d"
|
1703 |
+
],
|
1704 |
+
[
|
1705 |
+
0.2,
|
1706 |
+
"#de77ae"
|
1707 |
+
],
|
1708 |
+
[
|
1709 |
+
0.3,
|
1710 |
+
"#f1b6da"
|
1711 |
+
],
|
1712 |
+
[
|
1713 |
+
0.4,
|
1714 |
+
"#fde0ef"
|
1715 |
+
],
|
1716 |
+
[
|
1717 |
+
0.5,
|
1718 |
+
"#f7f7f7"
|
1719 |
+
],
|
1720 |
+
[
|
1721 |
+
0.6,
|
1722 |
+
"#e6f5d0"
|
1723 |
+
],
|
1724 |
+
[
|
1725 |
+
0.7,
|
1726 |
+
"#b8e186"
|
1727 |
+
],
|
1728 |
+
[
|
1729 |
+
0.8,
|
1730 |
+
"#7fbc41"
|
1731 |
+
],
|
1732 |
+
[
|
1733 |
+
0.9,
|
1734 |
+
"#4d9221"
|
1735 |
+
],
|
1736 |
+
[
|
1737 |
+
1,
|
1738 |
+
"#276419"
|
1739 |
+
]
|
1740 |
+
],
|
1741 |
+
"sequential": [
|
1742 |
+
[
|
1743 |
+
0,
|
1744 |
+
"#0d0887"
|
1745 |
+
],
|
1746 |
+
[
|
1747 |
+
0.1111111111111111,
|
1748 |
+
"#46039f"
|
1749 |
+
],
|
1750 |
+
[
|
1751 |
+
0.2222222222222222,
|
1752 |
+
"#7201a8"
|
1753 |
+
],
|
1754 |
+
[
|
1755 |
+
0.3333333333333333,
|
1756 |
+
"#9c179e"
|
1757 |
+
],
|
1758 |
+
[
|
1759 |
+
0.4444444444444444,
|
1760 |
+
"#bd3786"
|
1761 |
+
],
|
1762 |
+
[
|
1763 |
+
0.5555555555555556,
|
1764 |
+
"#d8576b"
|
1765 |
+
],
|
1766 |
+
[
|
1767 |
+
0.6666666666666666,
|
1768 |
+
"#ed7953"
|
1769 |
+
],
|
1770 |
+
[
|
1771 |
+
0.7777777777777778,
|
1772 |
+
"#fb9f3a"
|
1773 |
+
],
|
1774 |
+
[
|
1775 |
+
0.8888888888888888,
|
1776 |
+
"#fdca26"
|
1777 |
+
],
|
1778 |
+
[
|
1779 |
+
1,
|
1780 |
+
"#f0f921"
|
1781 |
+
]
|
1782 |
+
],
|
1783 |
+
"sequentialminus": [
|
1784 |
+
[
|
1785 |
+
0,
|
1786 |
+
"#0d0887"
|
1787 |
+
],
|
1788 |
+
[
|
1789 |
+
0.1111111111111111,
|
1790 |
+
"#46039f"
|
1791 |
+
],
|
1792 |
+
[
|
1793 |
+
0.2222222222222222,
|
1794 |
+
"#7201a8"
|
1795 |
+
],
|
1796 |
+
[
|
1797 |
+
0.3333333333333333,
|
1798 |
+
"#9c179e"
|
1799 |
+
],
|
1800 |
+
[
|
1801 |
+
0.4444444444444444,
|
1802 |
+
"#bd3786"
|
1803 |
+
],
|
1804 |
+
[
|
1805 |
+
0.5555555555555556,
|
1806 |
+
"#d8576b"
|
1807 |
+
],
|
1808 |
+
[
|
1809 |
+
0.6666666666666666,
|
1810 |
+
"#ed7953"
|
1811 |
+
],
|
1812 |
+
[
|
1813 |
+
0.7777777777777778,
|
1814 |
+
"#fb9f3a"
|
1815 |
+
],
|
1816 |
+
[
|
1817 |
+
0.8888888888888888,
|
1818 |
+
"#fdca26"
|
1819 |
+
],
|
1820 |
+
[
|
1821 |
+
1,
|
1822 |
+
"#f0f921"
|
1823 |
+
]
|
1824 |
+
]
|
1825 |
+
},
|
1826 |
+
"colorway": [
|
1827 |
+
"#636efa",
|
1828 |
+
"#EF553B",
|
1829 |
+
"#00cc96",
|
1830 |
+
"#ab63fa",
|
1831 |
+
"#FFA15A",
|
1832 |
+
"#19d3f3",
|
1833 |
+
"#FF6692",
|
1834 |
+
"#B6E880",
|
1835 |
+
"#FF97FF",
|
1836 |
+
"#FECB52"
|
1837 |
+
],
|
1838 |
+
"font": {
|
1839 |
+
"color": "#2a3f5f"
|
1840 |
+
},
|
1841 |
+
"geo": {
|
1842 |
+
"bgcolor": "white",
|
1843 |
+
"lakecolor": "white",
|
1844 |
+
"landcolor": "#E5ECF6",
|
1845 |
+
"showlakes": true,
|
1846 |
+
"showland": true,
|
1847 |
+
"subunitcolor": "white"
|
1848 |
+
},
|
1849 |
+
"hoverlabel": {
|
1850 |
+
"align": "left"
|
1851 |
+
},
|
1852 |
+
"hovermode": "closest",
|
1853 |
+
"mapbox": {
|
1854 |
+
"style": "light"
|
1855 |
+
},
|
1856 |
+
"paper_bgcolor": "white",
|
1857 |
+
"plot_bgcolor": "#E5ECF6",
|
1858 |
+
"polar": {
|
1859 |
+
"angularaxis": {
|
1860 |
+
"gridcolor": "white",
|
1861 |
+
"linecolor": "white",
|
1862 |
+
"ticks": ""
|
1863 |
+
},
|
1864 |
+
"bgcolor": "#E5ECF6",
|
1865 |
+
"radialaxis": {
|
1866 |
+
"gridcolor": "white",
|
1867 |
+
"linecolor": "white",
|
1868 |
+
"ticks": ""
|
1869 |
+
}
|
1870 |
+
},
|
1871 |
+
"scene": {
|
1872 |
+
"xaxis": {
|
1873 |
+
"backgroundcolor": "#E5ECF6",
|
1874 |
+
"gridcolor": "white",
|
1875 |
+
"gridwidth": 2,
|
1876 |
+
"linecolor": "white",
|
1877 |
+
"showbackground": true,
|
1878 |
+
"ticks": "",
|
1879 |
+
"zerolinecolor": "white"
|
1880 |
+
},
|
1881 |
+
"yaxis": {
|
1882 |
+
"backgroundcolor": "#E5ECF6",
|
1883 |
+
"gridcolor": "white",
|
1884 |
+
"gridwidth": 2,
|
1885 |
+
"linecolor": "white",
|
1886 |
+
"showbackground": true,
|
1887 |
+
"ticks": "",
|
1888 |
+
"zerolinecolor": "white"
|
1889 |
+
},
|
1890 |
+
"zaxis": {
|
1891 |
+
"backgroundcolor": "#E5ECF6",
|
1892 |
+
"gridcolor": "white",
|
1893 |
+
"gridwidth": 2,
|
1894 |
+
"linecolor": "white",
|
1895 |
+
"showbackground": true,
|
1896 |
+
"ticks": "",
|
1897 |
+
"zerolinecolor": "white"
|
1898 |
+
}
|
1899 |
+
},
|
1900 |
+
"shapedefaults": {
|
1901 |
+
"line": {
|
1902 |
+
"color": "#2a3f5f"
|
1903 |
+
}
|
1904 |
+
},
|
1905 |
+
"ternary": {
|
1906 |
+
"aaxis": {
|
1907 |
+
"gridcolor": "white",
|
1908 |
+
"linecolor": "white",
|
1909 |
+
"ticks": ""
|
1910 |
+
},
|
1911 |
+
"baxis": {
|
1912 |
+
"gridcolor": "white",
|
1913 |
+
"linecolor": "white",
|
1914 |
+
"ticks": ""
|
1915 |
+
},
|
1916 |
+
"bgcolor": "#E5ECF6",
|
1917 |
+
"caxis": {
|
1918 |
+
"gridcolor": "white",
|
1919 |
+
"linecolor": "white",
|
1920 |
+
"ticks": ""
|
1921 |
+
}
|
1922 |
+
},
|
1923 |
+
"title": {
|
1924 |
+
"x": 0.05
|
1925 |
+
},
|
1926 |
+
"xaxis": {
|
1927 |
+
"automargin": true,
|
1928 |
+
"gridcolor": "white",
|
1929 |
+
"linecolor": "white",
|
1930 |
+
"ticks": "",
|
1931 |
+
"title": {
|
1932 |
+
"standoff": 15
|
1933 |
+
},
|
1934 |
+
"zerolinecolor": "white",
|
1935 |
+
"zerolinewidth": 2
|
1936 |
+
},
|
1937 |
+
"yaxis": {
|
1938 |
+
"automargin": true,
|
1939 |
+
"gridcolor": "white",
|
1940 |
+
"linecolor": "white",
|
1941 |
+
"ticks": "",
|
1942 |
+
"title": {
|
1943 |
+
"standoff": 15
|
1944 |
+
},
|
1945 |
+
"zerolinecolor": "white",
|
1946 |
+
"zerolinewidth": 2
|
1947 |
+
}
|
1948 |
+
}
|
1949 |
+
},
|
1950 |
+
"xaxis": {
|
1951 |
+
"anchor": "y",
|
1952 |
+
"categoryarray": [
|
1953 |
+
"Monday",
|
1954 |
+
"Tuesday",
|
1955 |
+
"Wednesday",
|
1956 |
+
"Thursday",
|
1957 |
+
"Friday",
|
1958 |
+
"Saturday",
|
1959 |
+
"Sunday"
|
1960 |
+
],
|
1961 |
+
"categoryorder": "array",
|
1962 |
+
"domain": [
|
1963 |
+
0,
|
1964 |
+
1
|
1965 |
+
],
|
1966 |
+
"title": {
|
1967 |
+
"text": "Day of the Week"
|
1968 |
+
}
|
1969 |
+
},
|
1970 |
+
"yaxis": {
|
1971 |
+
"anchor": "x",
|
1972 |
+
"domain": [
|
1973 |
+
0,
|
1974 |
+
1
|
1975 |
+
],
|
1976 |
+
"title": {
|
1977 |
+
"text": "Vehicle Count"
|
1978 |
+
}
|
1979 |
+
}
|
1980 |
+
}
|
1981 |
+
}
|
1982 |
+
},
|
1983 |
+
"metadata": {},
|
1984 |
+
"output_type": "display_data"
|
1985 |
+
}
|
1986 |
+
],
|
1987 |
+
"source": [
|
1988 |
+
"fig = px.bar(new_df, x = 'day', y='vehicle', color='day', \n",
|
1989 |
+
" text_auto=True, labels={'day':'Day of the Week','vehicle':'Vehicle Count'})\n",
|
1990 |
+
"fig.show()"
|
1991 |
+
]
|
1992 |
+
},
|
1993 |
+
{
|
1994 |
+
"cell_type": "code",
|
1995 |
+
"execution_count": 10,
|
1996 |
+
"id": "269298dd",
|
1997 |
+
"metadata": {},
|
1998 |
+
"outputs": [
|
1999 |
+
{
|
2000 |
+
"data": {
|
2001 |
+
"application/vnd.plotly.v1+json": {
|
2002 |
+
"config": {
|
2003 |
+
"plotlyServerURL": "https://plot.ly"
|
2004 |
+
},
|
2005 |
+
"data": [
|
2006 |
+
{
|
2007 |
+
"coloraxis": "coloraxis",
|
2008 |
+
"hovertemplate": "Hour of the Day: %{x}<br>Day of the Week: %{y}<br>Causeway Traffic: %{z}<extra></extra>",
|
2009 |
+
"name": "0",
|
2010 |
+
"texttemplate": "%{z}",
|
2011 |
+
"type": "heatmap",
|
2012 |
+
"x": [
|
2013 |
+
"12am",
|
2014 |
+
"1am",
|
2015 |
+
"2am",
|
2016 |
+
"3am",
|
2017 |
+
"4am",
|
2018 |
+
"5am",
|
2019 |
+
"6am",
|
2020 |
+
"7am",
|
2021 |
+
"8am",
|
2022 |
+
"9am",
|
2023 |
+
"10am",
|
2024 |
+
"11am",
|
2025 |
+
"12pm",
|
2026 |
+
"1pm",
|
2027 |
+
"2pm",
|
2028 |
+
"3pm",
|
2029 |
+
"4pm",
|
2030 |
+
"5pm",
|
2031 |
+
"6pm",
|
2032 |
+
"7pm",
|
2033 |
+
"8pm",
|
2034 |
+
"9pm",
|
2035 |
+
"10pm",
|
2036 |
+
"11pm"
|
2037 |
+
],
|
2038 |
+
"xaxis": "x",
|
2039 |
+
"y": [
|
2040 |
+
"Monday",
|
2041 |
+
"Tuesday",
|
2042 |
+
"Wednesday",
|
2043 |
+
"Thursday",
|
2044 |
+
"Friday",
|
2045 |
+
"Saturday",
|
2046 |
+
"Sunday"
|
2047 |
+
],
|
2048 |
+
"yaxis": "y",
|
2049 |
+
"z": [
|
2050 |
+
[
|
2051 |
+
52,
|
2052 |
+
82,
|
2053 |
+
35,
|
2054 |
+
40,
|
2055 |
+
29,
|
2056 |
+
60,
|
2057 |
+
77,
|
2058 |
+
233,
|
2059 |
+
34,
|
2060 |
+
207,
|
2061 |
+
296,
|
2062 |
+
265,
|
2063 |
+
265,
|
2064 |
+
237,
|
2065 |
+
268,
|
2066 |
+
148,
|
2067 |
+
227,
|
2068 |
+
253,
|
2069 |
+
214,
|
2070 |
+
256,
|
2071 |
+
69,
|
2072 |
+
58,
|
2073 |
+
30,
|
2074 |
+
35
|
2075 |
+
],
|
2076 |
+
[
|
2077 |
+
58,
|
2078 |
+
30,
|
2079 |
+
19,
|
2080 |
+
14,
|
2081 |
+
15,
|
2082 |
+
35,
|
2083 |
+
85,
|
2084 |
+
144,
|
2085 |
+
47,
|
2086 |
+
154,
|
2087 |
+
227,
|
2088 |
+
226,
|
2089 |
+
192,
|
2090 |
+
113,
|
2091 |
+
186,
|
2092 |
+
202,
|
2093 |
+
243,
|
2094 |
+
207,
|
2095 |
+
265,
|
2096 |
+
168,
|
2097 |
+
49,
|
2098 |
+
40,
|
2099 |
+
46,
|
2100 |
+
49
|
2101 |
+
],
|
2102 |
+
[
|
2103 |
+
28,
|
2104 |
+
41,
|
2105 |
+
18,
|
2106 |
+
17,
|
2107 |
+
16,
|
2108 |
+
26,
|
2109 |
+
57,
|
2110 |
+
96,
|
2111 |
+
23,
|
2112 |
+
142,
|
2113 |
+
285,
|
2114 |
+
202,
|
2115 |
+
204,
|
2116 |
+
148,
|
2117 |
+
182,
|
2118 |
+
226,
|
2119 |
+
192,
|
2120 |
+
280,
|
2121 |
+
271,
|
2122 |
+
163,
|
2123 |
+
35,
|
2124 |
+
42,
|
2125 |
+
32,
|
2126 |
+
80
|
2127 |
+
],
|
2128 |
+
[
|
2129 |
+
22,
|
2130 |
+
38,
|
2131 |
+
18,
|
2132 |
+
18,
|
2133 |
+
36,
|
2134 |
+
44,
|
2135 |
+
75,
|
2136 |
+
249,
|
2137 |
+
66,
|
2138 |
+
239,
|
2139 |
+
285,
|
2140 |
+
244,
|
2141 |
+
171,
|
2142 |
+
166,
|
2143 |
+
111,
|
2144 |
+
130,
|
2145 |
+
197,
|
2146 |
+
225,
|
2147 |
+
184,
|
2148 |
+
163,
|
2149 |
+
57,
|
2150 |
+
45,
|
2151 |
+
45,
|
2152 |
+
51
|
2153 |
+
],
|
2154 |
+
[
|
2155 |
+
44,
|
2156 |
+
37,
|
2157 |
+
31,
|
2158 |
+
33,
|
2159 |
+
28,
|
2160 |
+
36,
|
2161 |
+
65,
|
2162 |
+
143,
|
2163 |
+
0,
|
2164 |
+
77,
|
2165 |
+
200,
|
2166 |
+
160,
|
2167 |
+
162,
|
2168 |
+
183,
|
2169 |
+
281,
|
2170 |
+
245,
|
2171 |
+
255,
|
2172 |
+
218,
|
2173 |
+
215,
|
2174 |
+
191,
|
2175 |
+
58,
|
2176 |
+
45,
|
2177 |
+
56,
|
2178 |
+
69
|
2179 |
+
],
|
2180 |
+
[
|
2181 |
+
50,
|
2182 |
+
43,
|
2183 |
+
24,
|
2184 |
+
21,
|
2185 |
+
30,
|
2186 |
+
48,
|
2187 |
+
53,
|
2188 |
+
189,
|
2189 |
+
37,
|
2190 |
+
127,
|
2191 |
+
235,
|
2192 |
+
141,
|
2193 |
+
93,
|
2194 |
+
186,
|
2195 |
+
170,
|
2196 |
+
214,
|
2197 |
+
170,
|
2198 |
+
209,
|
2199 |
+
271,
|
2200 |
+
164,
|
2201 |
+
61,
|
2202 |
+
54,
|
2203 |
+
48,
|
2204 |
+
57
|
2205 |
+
],
|
2206 |
+
[
|
2207 |
+
61,
|
2208 |
+
38,
|
2209 |
+
16,
|
2210 |
+
21,
|
2211 |
+
15,
|
2212 |
+
28,
|
2213 |
+
45,
|
2214 |
+
149,
|
2215 |
+
4,
|
2216 |
+
151,
|
2217 |
+
127,
|
2218 |
+
88,
|
2219 |
+
140,
|
2220 |
+
140,
|
2221 |
+
132,
|
2222 |
+
100,
|
2223 |
+
171,
|
2224 |
+
98,
|
2225 |
+
96,
|
2226 |
+
105,
|
2227 |
+
50,
|
2228 |
+
50,
|
2229 |
+
56,
|
2230 |
+
62
|
2231 |
+
]
|
2232 |
+
]
|
2233 |
+
}
|
2234 |
+
],
|
2235 |
+
"layout": {
|
2236 |
+
"coloraxis": {
|
2237 |
+
"colorbar": {
|
2238 |
+
"title": {
|
2239 |
+
"text": "Causeway Traffic"
|
2240 |
+
}
|
2241 |
+
},
|
2242 |
+
"colorscale": [
|
2243 |
+
[
|
2244 |
+
0,
|
2245 |
+
"#0d0887"
|
2246 |
+
],
|
2247 |
+
[
|
2248 |
+
0.1111111111111111,
|
2249 |
+
"#46039f"
|
2250 |
+
],
|
2251 |
+
[
|
2252 |
+
0.2222222222222222,
|
2253 |
+
"#7201a8"
|
2254 |
+
],
|
2255 |
+
[
|
2256 |
+
0.3333333333333333,
|
2257 |
+
"#9c179e"
|
2258 |
+
],
|
2259 |
+
[
|
2260 |
+
0.4444444444444444,
|
2261 |
+
"#bd3786"
|
2262 |
+
],
|
2263 |
+
[
|
2264 |
+
0.5555555555555556,
|
2265 |
+
"#d8576b"
|
2266 |
+
],
|
2267 |
+
[
|
2268 |
+
0.6666666666666666,
|
2269 |
+
"#ed7953"
|
2270 |
+
],
|
2271 |
+
[
|
2272 |
+
0.7777777777777778,
|
2273 |
+
"#fb9f3a"
|
2274 |
+
],
|
2275 |
+
[
|
2276 |
+
0.8888888888888888,
|
2277 |
+
"#fdca26"
|
2278 |
+
],
|
2279 |
+
[
|
2280 |
+
1,
|
2281 |
+
"#f0f921"
|
2282 |
+
]
|
2283 |
+
]
|
2284 |
+
},
|
2285 |
+
"margin": {
|
2286 |
+
"t": 60
|
2287 |
+
},
|
2288 |
+
"template": {
|
2289 |
+
"data": {
|
2290 |
+
"bar": [
|
2291 |
+
{
|
2292 |
+
"error_x": {
|
2293 |
+
"color": "#2a3f5f"
|
2294 |
+
},
|
2295 |
+
"error_y": {
|
2296 |
+
"color": "#2a3f5f"
|
2297 |
+
},
|
2298 |
+
"marker": {
|
2299 |
+
"line": {
|
2300 |
+
"color": "#E5ECF6",
|
2301 |
+
"width": 0.5
|
2302 |
+
},
|
2303 |
+
"pattern": {
|
2304 |
+
"fillmode": "overlay",
|
2305 |
+
"size": 10,
|
2306 |
+
"solidity": 0.2
|
2307 |
+
}
|
2308 |
+
},
|
2309 |
+
"type": "bar"
|
2310 |
+
}
|
2311 |
+
],
|
2312 |
+
"barpolar": [
|
2313 |
+
{
|
2314 |
+
"marker": {
|
2315 |
+
"line": {
|
2316 |
+
"color": "#E5ECF6",
|
2317 |
+
"width": 0.5
|
2318 |
+
},
|
2319 |
+
"pattern": {
|
2320 |
+
"fillmode": "overlay",
|
2321 |
+
"size": 10,
|
2322 |
+
"solidity": 0.2
|
2323 |
+
}
|
2324 |
+
},
|
2325 |
+
"type": "barpolar"
|
2326 |
+
}
|
2327 |
+
],
|
2328 |
+
"carpet": [
|
2329 |
+
{
|
2330 |
+
"aaxis": {
|
2331 |
+
"endlinecolor": "#2a3f5f",
|
2332 |
+
"gridcolor": "white",
|
2333 |
+
"linecolor": "white",
|
2334 |
+
"minorgridcolor": "white",
|
2335 |
+
"startlinecolor": "#2a3f5f"
|
2336 |
+
},
|
2337 |
+
"baxis": {
|
2338 |
+
"endlinecolor": "#2a3f5f",
|
2339 |
+
"gridcolor": "white",
|
2340 |
+
"linecolor": "white",
|
2341 |
+
"minorgridcolor": "white",
|
2342 |
+
"startlinecolor": "#2a3f5f"
|
2343 |
+
},
|
2344 |
+
"type": "carpet"
|
2345 |
+
}
|
2346 |
+
],
|
2347 |
+
"choropleth": [
|
2348 |
+
{
|
2349 |
+
"colorbar": {
|
2350 |
+
"outlinewidth": 0,
|
2351 |
+
"ticks": ""
|
2352 |
+
},
|
2353 |
+
"type": "choropleth"
|
2354 |
+
}
|
2355 |
+
],
|
2356 |
+
"contour": [
|
2357 |
+
{
|
2358 |
+
"colorbar": {
|
2359 |
+
"outlinewidth": 0,
|
2360 |
+
"ticks": ""
|
2361 |
+
},
|
2362 |
+
"colorscale": [
|
2363 |
+
[
|
2364 |
+
0,
|
2365 |
+
"#0d0887"
|
2366 |
+
],
|
2367 |
+
[
|
2368 |
+
0.1111111111111111,
|
2369 |
+
"#46039f"
|
2370 |
+
],
|
2371 |
+
[
|
2372 |
+
0.2222222222222222,
|
2373 |
+
"#7201a8"
|
2374 |
+
],
|
2375 |
+
[
|
2376 |
+
0.3333333333333333,
|
2377 |
+
"#9c179e"
|
2378 |
+
],
|
2379 |
+
[
|
2380 |
+
0.4444444444444444,
|
2381 |
+
"#bd3786"
|
2382 |
+
],
|
2383 |
+
[
|
2384 |
+
0.5555555555555556,
|
2385 |
+
"#d8576b"
|
2386 |
+
],
|
2387 |
+
[
|
2388 |
+
0.6666666666666666,
|
2389 |
+
"#ed7953"
|
2390 |
+
],
|
2391 |
+
[
|
2392 |
+
0.7777777777777778,
|
2393 |
+
"#fb9f3a"
|
2394 |
+
],
|
2395 |
+
[
|
2396 |
+
0.8888888888888888,
|
2397 |
+
"#fdca26"
|
2398 |
+
],
|
2399 |
+
[
|
2400 |
+
1,
|
2401 |
+
"#f0f921"
|
2402 |
+
]
|
2403 |
+
],
|
2404 |
+
"type": "contour"
|
2405 |
+
}
|
2406 |
+
],
|
2407 |
+
"contourcarpet": [
|
2408 |
+
{
|
2409 |
+
"colorbar": {
|
2410 |
+
"outlinewidth": 0,
|
2411 |
+
"ticks": ""
|
2412 |
+
},
|
2413 |
+
"type": "contourcarpet"
|
2414 |
+
}
|
2415 |
+
],
|
2416 |
+
"heatmap": [
|
2417 |
+
{
|
2418 |
+
"colorbar": {
|
2419 |
+
"outlinewidth": 0,
|
2420 |
+
"ticks": ""
|
2421 |
+
},
|
2422 |
+
"colorscale": [
|
2423 |
+
[
|
2424 |
+
0,
|
2425 |
+
"#0d0887"
|
2426 |
+
],
|
2427 |
+
[
|
2428 |
+
0.1111111111111111,
|
2429 |
+
"#46039f"
|
2430 |
+
],
|
2431 |
+
[
|
2432 |
+
0.2222222222222222,
|
2433 |
+
"#7201a8"
|
2434 |
+
],
|
2435 |
+
[
|
2436 |
+
0.3333333333333333,
|
2437 |
+
"#9c179e"
|
2438 |
+
],
|
2439 |
+
[
|
2440 |
+
0.4444444444444444,
|
2441 |
+
"#bd3786"
|
2442 |
+
],
|
2443 |
+
[
|
2444 |
+
0.5555555555555556,
|
2445 |
+
"#d8576b"
|
2446 |
+
],
|
2447 |
+
[
|
2448 |
+
0.6666666666666666,
|
2449 |
+
"#ed7953"
|
2450 |
+
],
|
2451 |
+
[
|
2452 |
+
0.7777777777777778,
|
2453 |
+
"#fb9f3a"
|
2454 |
+
],
|
2455 |
+
[
|
2456 |
+
0.8888888888888888,
|
2457 |
+
"#fdca26"
|
2458 |
+
],
|
2459 |
+
[
|
2460 |
+
1,
|
2461 |
+
"#f0f921"
|
2462 |
+
]
|
2463 |
+
],
|
2464 |
+
"type": "heatmap"
|
2465 |
+
}
|
2466 |
+
],
|
2467 |
+
"heatmapgl": [
|
2468 |
+
{
|
2469 |
+
"colorbar": {
|
2470 |
+
"outlinewidth": 0,
|
2471 |
+
"ticks": ""
|
2472 |
+
},
|
2473 |
+
"colorscale": [
|
2474 |
+
[
|
2475 |
+
0,
|
2476 |
+
"#0d0887"
|
2477 |
+
],
|
2478 |
+
[
|
2479 |
+
0.1111111111111111,
|
2480 |
+
"#46039f"
|
2481 |
+
],
|
2482 |
+
[
|
2483 |
+
0.2222222222222222,
|
2484 |
+
"#7201a8"
|
2485 |
+
],
|
2486 |
+
[
|
2487 |
+
0.3333333333333333,
|
2488 |
+
"#9c179e"
|
2489 |
+
],
|
2490 |
+
[
|
2491 |
+
0.4444444444444444,
|
2492 |
+
"#bd3786"
|
2493 |
+
],
|
2494 |
+
[
|
2495 |
+
0.5555555555555556,
|
2496 |
+
"#d8576b"
|
2497 |
+
],
|
2498 |
+
[
|
2499 |
+
0.6666666666666666,
|
2500 |
+
"#ed7953"
|
2501 |
+
],
|
2502 |
+
[
|
2503 |
+
0.7777777777777778,
|
2504 |
+
"#fb9f3a"
|
2505 |
+
],
|
2506 |
+
[
|
2507 |
+
0.8888888888888888,
|
2508 |
+
"#fdca26"
|
2509 |
+
],
|
2510 |
+
[
|
2511 |
+
1,
|
2512 |
+
"#f0f921"
|
2513 |
+
]
|
2514 |
+
],
|
2515 |
+
"type": "heatmapgl"
|
2516 |
+
}
|
2517 |
+
],
|
2518 |
+
"histogram": [
|
2519 |
+
{
|
2520 |
+
"marker": {
|
2521 |
+
"pattern": {
|
2522 |
+
"fillmode": "overlay",
|
2523 |
+
"size": 10,
|
2524 |
+
"solidity": 0.2
|
2525 |
+
}
|
2526 |
+
},
|
2527 |
+
"type": "histogram"
|
2528 |
+
}
|
2529 |
+
],
|
2530 |
+
"histogram2d": [
|
2531 |
+
{
|
2532 |
+
"colorbar": {
|
2533 |
+
"outlinewidth": 0,
|
2534 |
+
"ticks": ""
|
2535 |
+
},
|
2536 |
+
"colorscale": [
|
2537 |
+
[
|
2538 |
+
0,
|
2539 |
+
"#0d0887"
|
2540 |
+
],
|
2541 |
+
[
|
2542 |
+
0.1111111111111111,
|
2543 |
+
"#46039f"
|
2544 |
+
],
|
2545 |
+
[
|
2546 |
+
0.2222222222222222,
|
2547 |
+
"#7201a8"
|
2548 |
+
],
|
2549 |
+
[
|
2550 |
+
0.3333333333333333,
|
2551 |
+
"#9c179e"
|
2552 |
+
],
|
2553 |
+
[
|
2554 |
+
0.4444444444444444,
|
2555 |
+
"#bd3786"
|
2556 |
+
],
|
2557 |
+
[
|
2558 |
+
0.5555555555555556,
|
2559 |
+
"#d8576b"
|
2560 |
+
],
|
2561 |
+
[
|
2562 |
+
0.6666666666666666,
|
2563 |
+
"#ed7953"
|
2564 |
+
],
|
2565 |
+
[
|
2566 |
+
0.7777777777777778,
|
2567 |
+
"#fb9f3a"
|
2568 |
+
],
|
2569 |
+
[
|
2570 |
+
0.8888888888888888,
|
2571 |
+
"#fdca26"
|
2572 |
+
],
|
2573 |
+
[
|
2574 |
+
1,
|
2575 |
+
"#f0f921"
|
2576 |
+
]
|
2577 |
+
],
|
2578 |
+
"type": "histogram2d"
|
2579 |
+
}
|
2580 |
+
],
|
2581 |
+
"histogram2dcontour": [
|
2582 |
+
{
|
2583 |
+
"colorbar": {
|
2584 |
+
"outlinewidth": 0,
|
2585 |
+
"ticks": ""
|
2586 |
+
},
|
2587 |
+
"colorscale": [
|
2588 |
+
[
|
2589 |
+
0,
|
2590 |
+
"#0d0887"
|
2591 |
+
],
|
2592 |
+
[
|
2593 |
+
0.1111111111111111,
|
2594 |
+
"#46039f"
|
2595 |
+
],
|
2596 |
+
[
|
2597 |
+
0.2222222222222222,
|
2598 |
+
"#7201a8"
|
2599 |
+
],
|
2600 |
+
[
|
2601 |
+
0.3333333333333333,
|
2602 |
+
"#9c179e"
|
2603 |
+
],
|
2604 |
+
[
|
2605 |
+
0.4444444444444444,
|
2606 |
+
"#bd3786"
|
2607 |
+
],
|
2608 |
+
[
|
2609 |
+
0.5555555555555556,
|
2610 |
+
"#d8576b"
|
2611 |
+
],
|
2612 |
+
[
|
2613 |
+
0.6666666666666666,
|
2614 |
+
"#ed7953"
|
2615 |
+
],
|
2616 |
+
[
|
2617 |
+
0.7777777777777778,
|
2618 |
+
"#fb9f3a"
|
2619 |
+
],
|
2620 |
+
[
|
2621 |
+
0.8888888888888888,
|
2622 |
+
"#fdca26"
|
2623 |
+
],
|
2624 |
+
[
|
2625 |
+
1,
|
2626 |
+
"#f0f921"
|
2627 |
+
]
|
2628 |
+
],
|
2629 |
+
"type": "histogram2dcontour"
|
2630 |
+
}
|
2631 |
+
],
|
2632 |
+
"mesh3d": [
|
2633 |
+
{
|
2634 |
+
"colorbar": {
|
2635 |
+
"outlinewidth": 0,
|
2636 |
+
"ticks": ""
|
2637 |
+
},
|
2638 |
+
"type": "mesh3d"
|
2639 |
+
}
|
2640 |
+
],
|
2641 |
+
"parcoords": [
|
2642 |
+
{
|
2643 |
+
"line": {
|
2644 |
+
"colorbar": {
|
2645 |
+
"outlinewidth": 0,
|
2646 |
+
"ticks": ""
|
2647 |
+
}
|
2648 |
+
},
|
2649 |
+
"type": "parcoords"
|
2650 |
+
}
|
2651 |
+
],
|
2652 |
+
"pie": [
|
2653 |
+
{
|
2654 |
+
"automargin": true,
|
2655 |
+
"type": "pie"
|
2656 |
+
}
|
2657 |
+
],
|
2658 |
+
"scatter": [
|
2659 |
+
{
|
2660 |
+
"fillpattern": {
|
2661 |
+
"fillmode": "overlay",
|
2662 |
+
"size": 10,
|
2663 |
+
"solidity": 0.2
|
2664 |
+
},
|
2665 |
+
"type": "scatter"
|
2666 |
+
}
|
2667 |
+
],
|
2668 |
+
"scatter3d": [
|
2669 |
+
{
|
2670 |
+
"line": {
|
2671 |
+
"colorbar": {
|
2672 |
+
"outlinewidth": 0,
|
2673 |
+
"ticks": ""
|
2674 |
+
}
|
2675 |
+
},
|
2676 |
+
"marker": {
|
2677 |
+
"colorbar": {
|
2678 |
+
"outlinewidth": 0,
|
2679 |
+
"ticks": ""
|
2680 |
+
}
|
2681 |
+
},
|
2682 |
+
"type": "scatter3d"
|
2683 |
+
}
|
2684 |
+
],
|
2685 |
+
"scattercarpet": [
|
2686 |
+
{
|
2687 |
+
"marker": {
|
2688 |
+
"colorbar": {
|
2689 |
+
"outlinewidth": 0,
|
2690 |
+
"ticks": ""
|
2691 |
+
}
|
2692 |
+
},
|
2693 |
+
"type": "scattercarpet"
|
2694 |
+
}
|
2695 |
+
],
|
2696 |
+
"scattergeo": [
|
2697 |
+
{
|
2698 |
+
"marker": {
|
2699 |
+
"colorbar": {
|
2700 |
+
"outlinewidth": 0,
|
2701 |
+
"ticks": ""
|
2702 |
+
}
|
2703 |
+
},
|
2704 |
+
"type": "scattergeo"
|
2705 |
+
}
|
2706 |
+
],
|
2707 |
+
"scattergl": [
|
2708 |
+
{
|
2709 |
+
"marker": {
|
2710 |
+
"colorbar": {
|
2711 |
+
"outlinewidth": 0,
|
2712 |
+
"ticks": ""
|
2713 |
+
}
|
2714 |
+
},
|
2715 |
+
"type": "scattergl"
|
2716 |
+
}
|
2717 |
+
],
|
2718 |
+
"scattermapbox": [
|
2719 |
+
{
|
2720 |
+
"marker": {
|
2721 |
+
"colorbar": {
|
2722 |
+
"outlinewidth": 0,
|
2723 |
+
"ticks": ""
|
2724 |
+
}
|
2725 |
+
},
|
2726 |
+
"type": "scattermapbox"
|
2727 |
+
}
|
2728 |
+
],
|
2729 |
+
"scatterpolar": [
|
2730 |
+
{
|
2731 |
+
"marker": {
|
2732 |
+
"colorbar": {
|
2733 |
+
"outlinewidth": 0,
|
2734 |
+
"ticks": ""
|
2735 |
+
}
|
2736 |
+
},
|
2737 |
+
"type": "scatterpolar"
|
2738 |
+
}
|
2739 |
+
],
|
2740 |
+
"scatterpolargl": [
|
2741 |
+
{
|
2742 |
+
"marker": {
|
2743 |
+
"colorbar": {
|
2744 |
+
"outlinewidth": 0,
|
2745 |
+
"ticks": ""
|
2746 |
+
}
|
2747 |
+
},
|
2748 |
+
"type": "scatterpolargl"
|
2749 |
+
}
|
2750 |
+
],
|
2751 |
+
"scatterternary": [
|
2752 |
+
{
|
2753 |
+
"marker": {
|
2754 |
+
"colorbar": {
|
2755 |
+
"outlinewidth": 0,
|
2756 |
+
"ticks": ""
|
2757 |
+
}
|
2758 |
+
},
|
2759 |
+
"type": "scatterternary"
|
2760 |
+
}
|
2761 |
+
],
|
2762 |
+
"surface": [
|
2763 |
+
{
|
2764 |
+
"colorbar": {
|
2765 |
+
"outlinewidth": 0,
|
2766 |
+
"ticks": ""
|
2767 |
+
},
|
2768 |
+
"colorscale": [
|
2769 |
+
[
|
2770 |
+
0,
|
2771 |
+
"#0d0887"
|
2772 |
+
],
|
2773 |
+
[
|
2774 |
+
0.1111111111111111,
|
2775 |
+
"#46039f"
|
2776 |
+
],
|
2777 |
+
[
|
2778 |
+
0.2222222222222222,
|
2779 |
+
"#7201a8"
|
2780 |
+
],
|
2781 |
+
[
|
2782 |
+
0.3333333333333333,
|
2783 |
+
"#9c179e"
|
2784 |
+
],
|
2785 |
+
[
|
2786 |
+
0.4444444444444444,
|
2787 |
+
"#bd3786"
|
2788 |
+
],
|
2789 |
+
[
|
2790 |
+
0.5555555555555556,
|
2791 |
+
"#d8576b"
|
2792 |
+
],
|
2793 |
+
[
|
2794 |
+
0.6666666666666666,
|
2795 |
+
"#ed7953"
|
2796 |
+
],
|
2797 |
+
[
|
2798 |
+
0.7777777777777778,
|
2799 |
+
"#fb9f3a"
|
2800 |
+
],
|
2801 |
+
[
|
2802 |
+
0.8888888888888888,
|
2803 |
+
"#fdca26"
|
2804 |
+
],
|
2805 |
+
[
|
2806 |
+
1,
|
2807 |
+
"#f0f921"
|
2808 |
+
]
|
2809 |
+
],
|
2810 |
+
"type": "surface"
|
2811 |
+
}
|
2812 |
+
],
|
2813 |
+
"table": [
|
2814 |
+
{
|
2815 |
+
"cells": {
|
2816 |
+
"fill": {
|
2817 |
+
"color": "#EBF0F8"
|
2818 |
+
},
|
2819 |
+
"line": {
|
2820 |
+
"color": "white"
|
2821 |
+
}
|
2822 |
+
},
|
2823 |
+
"header": {
|
2824 |
+
"fill": {
|
2825 |
+
"color": "#C8D4E3"
|
2826 |
+
},
|
2827 |
+
"line": {
|
2828 |
+
"color": "white"
|
2829 |
+
}
|
2830 |
+
},
|
2831 |
+
"type": "table"
|
2832 |
+
}
|
2833 |
+
]
|
2834 |
+
},
|
2835 |
+
"layout": {
|
2836 |
+
"annotationdefaults": {
|
2837 |
+
"arrowcolor": "#2a3f5f",
|
2838 |
+
"arrowhead": 0,
|
2839 |
+
"arrowwidth": 1
|
2840 |
+
},
|
2841 |
+
"autotypenumbers": "strict",
|
2842 |
+
"coloraxis": {
|
2843 |
+
"colorbar": {
|
2844 |
+
"outlinewidth": 0,
|
2845 |
+
"ticks": ""
|
2846 |
+
}
|
2847 |
+
},
|
2848 |
+
"colorscale": {
|
2849 |
+
"diverging": [
|
2850 |
+
[
|
2851 |
+
0,
|
2852 |
+
"#8e0152"
|
2853 |
+
],
|
2854 |
+
[
|
2855 |
+
0.1,
|
2856 |
+
"#c51b7d"
|
2857 |
+
],
|
2858 |
+
[
|
2859 |
+
0.2,
|
2860 |
+
"#de77ae"
|
2861 |
+
],
|
2862 |
+
[
|
2863 |
+
0.3,
|
2864 |
+
"#f1b6da"
|
2865 |
+
],
|
2866 |
+
[
|
2867 |
+
0.4,
|
2868 |
+
"#fde0ef"
|
2869 |
+
],
|
2870 |
+
[
|
2871 |
+
0.5,
|
2872 |
+
"#f7f7f7"
|
2873 |
+
],
|
2874 |
+
[
|
2875 |
+
0.6,
|
2876 |
+
"#e6f5d0"
|
2877 |
+
],
|
2878 |
+
[
|
2879 |
+
0.7,
|
2880 |
+
"#b8e186"
|
2881 |
+
],
|
2882 |
+
[
|
2883 |
+
0.8,
|
2884 |
+
"#7fbc41"
|
2885 |
+
],
|
2886 |
+
[
|
2887 |
+
0.9,
|
2888 |
+
"#4d9221"
|
2889 |
+
],
|
2890 |
+
[
|
2891 |
+
1,
|
2892 |
+
"#276419"
|
2893 |
+
]
|
2894 |
+
],
|
2895 |
+
"sequential": [
|
2896 |
+
[
|
2897 |
+
0,
|
2898 |
+
"#0d0887"
|
2899 |
+
],
|
2900 |
+
[
|
2901 |
+
0.1111111111111111,
|
2902 |
+
"#46039f"
|
2903 |
+
],
|
2904 |
+
[
|
2905 |
+
0.2222222222222222,
|
2906 |
+
"#7201a8"
|
2907 |
+
],
|
2908 |
+
[
|
2909 |
+
0.3333333333333333,
|
2910 |
+
"#9c179e"
|
2911 |
+
],
|
2912 |
+
[
|
2913 |
+
0.4444444444444444,
|
2914 |
+
"#bd3786"
|
2915 |
+
],
|
2916 |
+
[
|
2917 |
+
0.5555555555555556,
|
2918 |
+
"#d8576b"
|
2919 |
+
],
|
2920 |
+
[
|
2921 |
+
0.6666666666666666,
|
2922 |
+
"#ed7953"
|
2923 |
+
],
|
2924 |
+
[
|
2925 |
+
0.7777777777777778,
|
2926 |
+
"#fb9f3a"
|
2927 |
+
],
|
2928 |
+
[
|
2929 |
+
0.8888888888888888,
|
2930 |
+
"#fdca26"
|
2931 |
+
],
|
2932 |
+
[
|
2933 |
+
1,
|
2934 |
+
"#f0f921"
|
2935 |
+
]
|
2936 |
+
],
|
2937 |
+
"sequentialminus": [
|
2938 |
+
[
|
2939 |
+
0,
|
2940 |
+
"#0d0887"
|
2941 |
+
],
|
2942 |
+
[
|
2943 |
+
0.1111111111111111,
|
2944 |
+
"#46039f"
|
2945 |
+
],
|
2946 |
+
[
|
2947 |
+
0.2222222222222222,
|
2948 |
+
"#7201a8"
|
2949 |
+
],
|
2950 |
+
[
|
2951 |
+
0.3333333333333333,
|
2952 |
+
"#9c179e"
|
2953 |
+
],
|
2954 |
+
[
|
2955 |
+
0.4444444444444444,
|
2956 |
+
"#bd3786"
|
2957 |
+
],
|
2958 |
+
[
|
2959 |
+
0.5555555555555556,
|
2960 |
+
"#d8576b"
|
2961 |
+
],
|
2962 |
+
[
|
2963 |
+
0.6666666666666666,
|
2964 |
+
"#ed7953"
|
2965 |
+
],
|
2966 |
+
[
|
2967 |
+
0.7777777777777778,
|
2968 |
+
"#fb9f3a"
|
2969 |
+
],
|
2970 |
+
[
|
2971 |
+
0.8888888888888888,
|
2972 |
+
"#fdca26"
|
2973 |
+
],
|
2974 |
+
[
|
2975 |
+
1,
|
2976 |
+
"#f0f921"
|
2977 |
+
]
|
2978 |
+
]
|
2979 |
+
},
|
2980 |
+
"colorway": [
|
2981 |
+
"#636efa",
|
2982 |
+
"#EF553B",
|
2983 |
+
"#00cc96",
|
2984 |
+
"#ab63fa",
|
2985 |
+
"#FFA15A",
|
2986 |
+
"#19d3f3",
|
2987 |
+
"#FF6692",
|
2988 |
+
"#B6E880",
|
2989 |
+
"#FF97FF",
|
2990 |
+
"#FECB52"
|
2991 |
+
],
|
2992 |
+
"font": {
|
2993 |
+
"color": "#2a3f5f"
|
2994 |
+
},
|
2995 |
+
"geo": {
|
2996 |
+
"bgcolor": "white",
|
2997 |
+
"lakecolor": "white",
|
2998 |
+
"landcolor": "#E5ECF6",
|
2999 |
+
"showlakes": true,
|
3000 |
+
"showland": true,
|
3001 |
+
"subunitcolor": "white"
|
3002 |
+
},
|
3003 |
+
"hoverlabel": {
|
3004 |
+
"align": "left"
|
3005 |
+
},
|
3006 |
+
"hovermode": "closest",
|
3007 |
+
"mapbox": {
|
3008 |
+
"style": "light"
|
3009 |
+
},
|
3010 |
+
"paper_bgcolor": "white",
|
3011 |
+
"plot_bgcolor": "#E5ECF6",
|
3012 |
+
"polar": {
|
3013 |
+
"angularaxis": {
|
3014 |
+
"gridcolor": "white",
|
3015 |
+
"linecolor": "white",
|
3016 |
+
"ticks": ""
|
3017 |
+
},
|
3018 |
+
"bgcolor": "#E5ECF6",
|
3019 |
+
"radialaxis": {
|
3020 |
+
"gridcolor": "white",
|
3021 |
+
"linecolor": "white",
|
3022 |
+
"ticks": ""
|
3023 |
+
}
|
3024 |
+
},
|
3025 |
+
"scene": {
|
3026 |
+
"xaxis": {
|
3027 |
+
"backgroundcolor": "#E5ECF6",
|
3028 |
+
"gridcolor": "white",
|
3029 |
+
"gridwidth": 2,
|
3030 |
+
"linecolor": "white",
|
3031 |
+
"showbackground": true,
|
3032 |
+
"ticks": "",
|
3033 |
+
"zerolinecolor": "white"
|
3034 |
+
},
|
3035 |
+
"yaxis": {
|
3036 |
+
"backgroundcolor": "#E5ECF6",
|
3037 |
+
"gridcolor": "white",
|
3038 |
+
"gridwidth": 2,
|
3039 |
+
"linecolor": "white",
|
3040 |
+
"showbackground": true,
|
3041 |
+
"ticks": "",
|
3042 |
+
"zerolinecolor": "white"
|
3043 |
+
},
|
3044 |
+
"zaxis": {
|
3045 |
+
"backgroundcolor": "#E5ECF6",
|
3046 |
+
"gridcolor": "white",
|
3047 |
+
"gridwidth": 2,
|
3048 |
+
"linecolor": "white",
|
3049 |
+
"showbackground": true,
|
3050 |
+
"ticks": "",
|
3051 |
+
"zerolinecolor": "white"
|
3052 |
+
}
|
3053 |
+
},
|
3054 |
+
"shapedefaults": {
|
3055 |
+
"line": {
|
3056 |
+
"color": "#2a3f5f"
|
3057 |
+
}
|
3058 |
+
},
|
3059 |
+
"ternary": {
|
3060 |
+
"aaxis": {
|
3061 |
+
"gridcolor": "white",
|
3062 |
+
"linecolor": "white",
|
3063 |
+
"ticks": ""
|
3064 |
+
},
|
3065 |
+
"baxis": {
|
3066 |
+
"gridcolor": "white",
|
3067 |
+
"linecolor": "white",
|
3068 |
+
"ticks": ""
|
3069 |
+
},
|
3070 |
+
"bgcolor": "#E5ECF6",
|
3071 |
+
"caxis": {
|
3072 |
+
"gridcolor": "white",
|
3073 |
+
"linecolor": "white",
|
3074 |
+
"ticks": ""
|
3075 |
+
}
|
3076 |
+
},
|
3077 |
+
"title": {
|
3078 |
+
"x": 0.05
|
3079 |
+
},
|
3080 |
+
"xaxis": {
|
3081 |
+
"automargin": true,
|
3082 |
+
"gridcolor": "white",
|
3083 |
+
"linecolor": "white",
|
3084 |
+
"ticks": "",
|
3085 |
+
"title": {
|
3086 |
+
"standoff": 15
|
3087 |
+
},
|
3088 |
+
"zerolinecolor": "white",
|
3089 |
+
"zerolinewidth": 2
|
3090 |
+
},
|
3091 |
+
"yaxis": {
|
3092 |
+
"automargin": true,
|
3093 |
+
"gridcolor": "white",
|
3094 |
+
"linecolor": "white",
|
3095 |
+
"ticks": "",
|
3096 |
+
"title": {
|
3097 |
+
"standoff": 15
|
3098 |
+
},
|
3099 |
+
"zerolinecolor": "white",
|
3100 |
+
"zerolinewidth": 2
|
3101 |
+
}
|
3102 |
+
}
|
3103 |
+
},
|
3104 |
+
"xaxis": {
|
3105 |
+
"anchor": "y",
|
3106 |
+
"constrain": "domain",
|
3107 |
+
"domain": [
|
3108 |
+
0,
|
3109 |
+
1
|
3110 |
+
],
|
3111 |
+
"scaleanchor": "y",
|
3112 |
+
"side": "top",
|
3113 |
+
"title": {
|
3114 |
+
"text": "Hour of the Day"
|
3115 |
+
}
|
3116 |
+
},
|
3117 |
+
"yaxis": {
|
3118 |
+
"anchor": "x",
|
3119 |
+
"autorange": "reversed",
|
3120 |
+
"constrain": "domain",
|
3121 |
+
"domain": [
|
3122 |
+
0,
|
3123 |
+
1
|
3124 |
+
],
|
3125 |
+
"title": {
|
3126 |
+
"text": "Day of the Week"
|
3127 |
+
}
|
3128 |
+
}
|
3129 |
+
}
|
3130 |
+
}
|
3131 |
+
},
|
3132 |
+
"metadata": {},
|
3133 |
+
"output_type": "display_data"
|
3134 |
+
}
|
3135 |
+
],
|
3136 |
+
"source": [
|
3137 |
+
"new_table = table.iloc[:,1:].to_numpy()\n",
|
3138 |
+
"fig1 = px.imshow(new_table, labels=dict(x=\"Hour of the Day\", y = 'Day of the Week', color='Causeway Traffic'),\n",
|
3139 |
+
" x=['12am', '1am', '2am', '3am', '4am', '5am', '6am', '7am', '8am', '9am', '10am', '11am', '12pm',\n",
|
3140 |
+
" '1pm', '2pm', '3pm', '4pm', '5pm', '6pm', '7pm', '8pm', '9pm', '10pm', \"11pm\"],\n",
|
3141 |
+
" y=[\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\",\n",
|
3142 |
+
" \"Saturday\", \"Sunday\"], text_auto=True)\n",
|
3143 |
+
"fig1.update_xaxes(side='top')"
|
3144 |
+
]
|
3145 |
+
},
|
3146 |
+
{
|
3147 |
+
"cell_type": "code",
|
3148 |
+
"execution_count": 11,
|
3149 |
+
"id": "928a2063",
|
3150 |
+
"metadata": {},
|
3151 |
+
"outputs": [],
|
3152 |
+
"source": [
|
3153 |
+
"#fig = make_subplots(rows=1, cols=2, specs=[[{'type':'bar'},{'type':'bar'}]],\n",
|
3154 |
+
" #subplot_titles=('Hours', 'Days'))"
|
3155 |
+
]
|
3156 |
+
},
|
3157 |
+
{
|
3158 |
+
"cell_type": "code",
|
3159 |
+
"execution_count": 12,
|
3160 |
+
"id": "b622fd70",
|
3161 |
+
"metadata": {},
|
3162 |
+
"outputs": [
|
3163 |
+
{
|
3164 |
+
"name": "stdout",
|
3165 |
+
"output_type": "stream",
|
3166 |
+
"text": [
|
3167 |
+
"Dash is running on http://127.0.0.1:8050/\n",
|
3168 |
+
"\n"
|
3169 |
+
]
|
3170 |
+
},
|
3171 |
+
{
|
3172 |
+
"data": {
|
3173 |
+
"text/html": [
|
3174 |
+
"\n",
|
3175 |
+
" <iframe\n",
|
3176 |
+
" width=\"100%\"\n",
|
3177 |
+
" height=\"650\"\n",
|
3178 |
+
" src=\"http://127.0.0.1:8050/\"\n",
|
3179 |
+
" frameborder=\"0\"\n",
|
3180 |
+
" allowfullscreen\n",
|
3181 |
+
" \n",
|
3182 |
+
" ></iframe>\n",
|
3183 |
+
" "
|
3184 |
+
],
|
3185 |
+
"text/plain": [
|
3186 |
+
"<IPython.lib.display.IFrame at 0x222c7ae9f70>"
|
3187 |
+
]
|
3188 |
+
},
|
3189 |
+
"metadata": {},
|
3190 |
+
"output_type": "display_data"
|
3191 |
+
}
|
3192 |
+
],
|
3193 |
+
"source": [
|
3194 |
+
"app_new = JupyterDash(__name__)\n",
|
3195 |
+
"\n",
|
3196 |
+
"app_new.title = 'CSE6242 Dashboard'\n",
|
3197 |
+
"app_new.layout = html.Div([\n",
|
3198 |
+
" html.Div(html.H2(\"Causian Dashboard\"), style={'width':'250px', 'height':'60px', 'padding-left':'2%',\n",
|
3199 |
+
" 'display':'inline-block'}),\n",
|
3200 |
+
" html.Div([\n",
|
3201 |
+
" html.Label(\"Hours\"), dcc.Dropdown(id='hours_dropdown_id',\n",
|
3202 |
+
" options=['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', \n",
|
3203 |
+
" '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00','19:00',\n",
|
3204 |
+
" '20:00', '21:00', '22:00', '23:00'],\n",
|
3205 |
+
" value='07:00', clearable=False)],\n",
|
3206 |
+
" style={'width':'20%','height':'60px', 'padding-left':'2%',\n",
|
3207 |
+
" 'display':'inline-block'}),\n",
|
3208 |
+
" html.Div([html.Label(\"Day of the Week\"), dcc.Dropdown(id='days_dropdown_id', value='Monday',\n",
|
3209 |
+
" options=[\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\",\"Saturday\", \"Sunday\"],\n",
|
3210 |
+
" clearable=False)],\n",
|
3211 |
+
" style={'width':'20%','height':'60px', 'padding-left':'2%',\n",
|
3212 |
+
" 'display':'inline-block'}),\n",
|
3213 |
+
" html.Div(dcc.Graph(id='fig_hours')),\n",
|
3214 |
+
" html.Div(dcc.Graph(id='fig_days')),\n",
|
3215 |
+
" html.Div(dcc.Graph(id='fig_heatplot', figure=fig1))])\n",
|
3216 |
+
"\n",
|
3217 |
+
"@app_new.callback(Output('fig_hours', \"figure\"), Input('hours_dropdown_id', \"value\"))\n",
|
3218 |
+
"def update_hour_bar_chart(Hours):\n",
|
3219 |
+
" fig_hours = px.bar(table, x='day', y=str(Hours), color='day', text_auto=True, labels={'day':\"Day of the Week\"})\n",
|
3220 |
+
" return fig_hours\n",
|
3221 |
+
"@app_new.callback(Output('fig_days', \"figure\"), Input('days_dropdown_id', \"value\"))\n",
|
3222 |
+
"def update_day_bar_chart(day):\n",
|
3223 |
+
" fig_days = px.bar(t, x='hour', y = str(day), color=str(day), text_auto=True, labels={'hour':\"Count of Each Hour\"})\n",
|
3224 |
+
" return fig_days\n",
|
3225 |
+
"\n",
|
3226 |
+
"app_new.run_server(mode='inline')"
|
3227 |
+
]
|
3228 |
+
},
|
3229 |
+
{
|
3230 |
+
"cell_type": "code",
|
3231 |
+
"execution_count": 13,
|
3232 |
+
"id": "66f580aa",
|
3233 |
+
"metadata": {},
|
3234 |
+
"outputs": [
|
3235 |
+
{
|
3236 |
+
"name": "stdout",
|
3237 |
+
"output_type": "stream",
|
3238 |
+
"text": [
|
3239 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
3240 |
+
"RangeIndex: 168 entries, 0 to 167\n",
|
3241 |
+
"Data columns (total 3 columns):\n",
|
3242 |
+
" # Column Non-Null Count Dtype \n",
|
3243 |
+
"--- ------ -------------- ----- \n",
|
3244 |
+
" 0 hour 168 non-null category\n",
|
3245 |
+
" 1 day 168 non-null category\n",
|
3246 |
+
" 2 vehicle 168 non-null int64 \n",
|
3247 |
+
"dtypes: category(2), int64(1)\n",
|
3248 |
+
"memory usage: 2.8 KB\n",
|
3249 |
+
"None\n"
|
3250 |
+
]
|
3251 |
+
}
|
3252 |
+
],
|
3253 |
+
"source": [
|
3254 |
+
"#Trial basic Linear Regression Model\n",
|
3255 |
+
"new['hour'] = new['hour'].astype('category')\n",
|
3256 |
+
"new['day'] = new['day'].astype('category')\n",
|
3257 |
+
"print(new.info())"
|
3258 |
+
]
|
3259 |
+
},
|
3260 |
+
{
|
3261 |
+
"cell_type": "code",
|
3262 |
+
"execution_count": null,
|
3263 |
+
"id": "4858f7d3",
|
3264 |
+
"metadata": {},
|
3265 |
+
"outputs": [],
|
3266 |
+
"source": []
|
3267 |
+
},
|
3268 |
+
{
|
3269 |
+
"cell_type": "code",
|
3270 |
+
"execution_count": 14,
|
3271 |
+
"id": "0806a79a",
|
3272 |
+
"metadata": {},
|
3273 |
+
"outputs": [
|
3274 |
+
{
|
3275 |
+
"data": {
|
3276 |
+
"text/html": [
|
3277 |
+
"<div>\n",
|
3278 |
+
"<style scoped>\n",
|
3279 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
3280 |
+
" vertical-align: middle;\n",
|
3281 |
+
" }\n",
|
3282 |
+
"\n",
|
3283 |
+
" .dataframe tbody tr th {\n",
|
3284 |
+
" vertical-align: top;\n",
|
3285 |
+
" }\n",
|
3286 |
+
"\n",
|
3287 |
+
" .dataframe thead th {\n",
|
3288 |
+
" text-align: right;\n",
|
3289 |
+
" }\n",
|
3290 |
+
"</style>\n",
|
3291 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
3292 |
+
" <thead>\n",
|
3293 |
+
" <tr style=\"text-align: right;\">\n",
|
3294 |
+
" <th></th>\n",
|
3295 |
+
" <th>hour_00:00</th>\n",
|
3296 |
+
" <th>hour_01:00</th>\n",
|
3297 |
+
" <th>hour_02:00</th>\n",
|
3298 |
+
" <th>hour_03:00</th>\n",
|
3299 |
+
" <th>hour_04:00</th>\n",
|
3300 |
+
" <th>hour_05:00</th>\n",
|
3301 |
+
" <th>hour_06:00</th>\n",
|
3302 |
+
" <th>hour_07:00</th>\n",
|
3303 |
+
" <th>hour_08:00</th>\n",
|
3304 |
+
" <th>hour_09:00</th>\n",
|
3305 |
+
" <th>...</th>\n",
|
3306 |
+
" <th>hour_21:00</th>\n",
|
3307 |
+
" <th>hour_22:00</th>\n",
|
3308 |
+
" <th>hour_23:00</th>\n",
|
3309 |
+
" <th>day_Friday</th>\n",
|
3310 |
+
" <th>day_Monday</th>\n",
|
3311 |
+
" <th>day_Saturday</th>\n",
|
3312 |
+
" <th>day_Sunday</th>\n",
|
3313 |
+
" <th>day_Thursday</th>\n",
|
3314 |
+
" <th>day_Tuesday</th>\n",
|
3315 |
+
" <th>day_Wednesday</th>\n",
|
3316 |
+
" </tr>\n",
|
3317 |
+
" </thead>\n",
|
3318 |
+
" <tbody>\n",
|
3319 |
+
" <tr>\n",
|
3320 |
+
" <th>0</th>\n",
|
3321 |
+
" <td>1</td>\n",
|
3322 |
+
" <td>0</td>\n",
|
3323 |
+
" <td>0</td>\n",
|
3324 |
+
" <td>0</td>\n",
|
3325 |
+
" <td>0</td>\n",
|
3326 |
+
" <td>0</td>\n",
|
3327 |
+
" <td>0</td>\n",
|
3328 |
+
" <td>0</td>\n",
|
3329 |
+
" <td>0</td>\n",
|
3330 |
+
" <td>0</td>\n",
|
3331 |
+
" <td>...</td>\n",
|
3332 |
+
" <td>0</td>\n",
|
3333 |
+
" <td>0</td>\n",
|
3334 |
+
" <td>0</td>\n",
|
3335 |
+
" <td>1</td>\n",
|
3336 |
+
" <td>0</td>\n",
|
3337 |
+
" <td>0</td>\n",
|
3338 |
+
" <td>0</td>\n",
|
3339 |
+
" <td>0</td>\n",
|
3340 |
+
" <td>0</td>\n",
|
3341 |
+
" <td>0</td>\n",
|
3342 |
+
" </tr>\n",
|
3343 |
+
" <tr>\n",
|
3344 |
+
" <th>1</th>\n",
|
3345 |
+
" <td>1</td>\n",
|
3346 |
+
" <td>0</td>\n",
|
3347 |
+
" <td>0</td>\n",
|
3348 |
+
" <td>0</td>\n",
|
3349 |
+
" <td>0</td>\n",
|
3350 |
+
" <td>0</td>\n",
|
3351 |
+
" <td>0</td>\n",
|
3352 |
+
" <td>0</td>\n",
|
3353 |
+
" <td>0</td>\n",
|
3354 |
+
" <td>0</td>\n",
|
3355 |
+
" <td>...</td>\n",
|
3356 |
+
" <td>0</td>\n",
|
3357 |
+
" <td>0</td>\n",
|
3358 |
+
" <td>0</td>\n",
|
3359 |
+
" <td>0</td>\n",
|
3360 |
+
" <td>1</td>\n",
|
3361 |
+
" <td>0</td>\n",
|
3362 |
+
" <td>0</td>\n",
|
3363 |
+
" <td>0</td>\n",
|
3364 |
+
" <td>0</td>\n",
|
3365 |
+
" <td>0</td>\n",
|
3366 |
+
" </tr>\n",
|
3367 |
+
" <tr>\n",
|
3368 |
+
" <th>2</th>\n",
|
3369 |
+
" <td>1</td>\n",
|
3370 |
+
" <td>0</td>\n",
|
3371 |
+
" <td>0</td>\n",
|
3372 |
+
" <td>0</td>\n",
|
3373 |
+
" <td>0</td>\n",
|
3374 |
+
" <td>0</td>\n",
|
3375 |
+
" <td>0</td>\n",
|
3376 |
+
" <td>0</td>\n",
|
3377 |
+
" <td>0</td>\n",
|
3378 |
+
" <td>0</td>\n",
|
3379 |
+
" <td>...</td>\n",
|
3380 |
+
" <td>0</td>\n",
|
3381 |
+
" <td>0</td>\n",
|
3382 |
+
" <td>0</td>\n",
|
3383 |
+
" <td>0</td>\n",
|
3384 |
+
" <td>0</td>\n",
|
3385 |
+
" <td>1</td>\n",
|
3386 |
+
" <td>0</td>\n",
|
3387 |
+
" <td>0</td>\n",
|
3388 |
+
" <td>0</td>\n",
|
3389 |
+
" <td>0</td>\n",
|
3390 |
+
" </tr>\n",
|
3391 |
+
" <tr>\n",
|
3392 |
+
" <th>3</th>\n",
|
3393 |
+
" <td>1</td>\n",
|
3394 |
+
" <td>0</td>\n",
|
3395 |
+
" <td>0</td>\n",
|
3396 |
+
" <td>0</td>\n",
|
3397 |
+
" <td>0</td>\n",
|
3398 |
+
" <td>0</td>\n",
|
3399 |
+
" <td>0</td>\n",
|
3400 |
+
" <td>0</td>\n",
|
3401 |
+
" <td>0</td>\n",
|
3402 |
+
" <td>0</td>\n",
|
3403 |
+
" <td>...</td>\n",
|
3404 |
+
" <td>0</td>\n",
|
3405 |
+
" <td>0</td>\n",
|
3406 |
+
" <td>0</td>\n",
|
3407 |
+
" <td>0</td>\n",
|
3408 |
+
" <td>0</td>\n",
|
3409 |
+
" <td>0</td>\n",
|
3410 |
+
" <td>1</td>\n",
|
3411 |
+
" <td>0</td>\n",
|
3412 |
+
" <td>0</td>\n",
|
3413 |
+
" <td>0</td>\n",
|
3414 |
+
" </tr>\n",
|
3415 |
+
" <tr>\n",
|
3416 |
+
" <th>4</th>\n",
|
3417 |
+
" <td>1</td>\n",
|
3418 |
+
" <td>0</td>\n",
|
3419 |
+
" <td>0</td>\n",
|
3420 |
+
" <td>0</td>\n",
|
3421 |
+
" <td>0</td>\n",
|
3422 |
+
" <td>0</td>\n",
|
3423 |
+
" <td>0</td>\n",
|
3424 |
+
" <td>0</td>\n",
|
3425 |
+
" <td>0</td>\n",
|
3426 |
+
" <td>0</td>\n",
|
3427 |
+
" <td>...</td>\n",
|
3428 |
+
" <td>0</td>\n",
|
3429 |
+
" <td>0</td>\n",
|
3430 |
+
" <td>0</td>\n",
|
3431 |
+
" <td>0</td>\n",
|
3432 |
+
" <td>0</td>\n",
|
3433 |
+
" <td>0</td>\n",
|
3434 |
+
" <td>0</td>\n",
|
3435 |
+
" <td>1</td>\n",
|
3436 |
+
" <td>0</td>\n",
|
3437 |
+
" <td>0</td>\n",
|
3438 |
+
" </tr>\n",
|
3439 |
+
" </tbody>\n",
|
3440 |
+
"</table>\n",
|
3441 |
+
"<p>5 rows × 31 columns</p>\n",
|
3442 |
+
"</div>"
|
3443 |
+
],
|
3444 |
+
"text/plain": [
|
3445 |
+
" hour_00:00 hour_01:00 hour_02:00 hour_03:00 hour_04:00 hour_05:00 \\\n",
|
3446 |
+
"0 1 0 0 0 0 0 \n",
|
3447 |
+
"1 1 0 0 0 0 0 \n",
|
3448 |
+
"2 1 0 0 0 0 0 \n",
|
3449 |
+
"3 1 0 0 0 0 0 \n",
|
3450 |
+
"4 1 0 0 0 0 0 \n",
|
3451 |
+
"\n",
|
3452 |
+
" hour_06:00 hour_07:00 hour_08:00 hour_09:00 ... hour_21:00 \\\n",
|
3453 |
+
"0 0 0 0 0 ... 0 \n",
|
3454 |
+
"1 0 0 0 0 ... 0 \n",
|
3455 |
+
"2 0 0 0 0 ... 0 \n",
|
3456 |
+
"3 0 0 0 0 ... 0 \n",
|
3457 |
+
"4 0 0 0 0 ... 0 \n",
|
3458 |
+
"\n",
|
3459 |
+
" hour_22:00 hour_23:00 day_Friday day_Monday day_Saturday day_Sunday \\\n",
|
3460 |
+
"0 0 0 1 0 0 0 \n",
|
3461 |
+
"1 0 0 0 1 0 0 \n",
|
3462 |
+
"2 0 0 0 0 1 0 \n",
|
3463 |
+
"3 0 0 0 0 0 1 \n",
|
3464 |
+
"4 0 0 0 0 0 0 \n",
|
3465 |
+
"\n",
|
3466 |
+
" day_Thursday day_Tuesday day_Wednesday \n",
|
3467 |
+
"0 0 0 0 \n",
|
3468 |
+
"1 0 0 0 \n",
|
3469 |
+
"2 0 0 0 \n",
|
3470 |
+
"3 0 0 0 \n",
|
3471 |
+
"4 1 0 0 \n",
|
3472 |
+
"\n",
|
3473 |
+
"[5 rows x 31 columns]"
|
3474 |
+
]
|
3475 |
+
},
|
3476 |
+
"metadata": {},
|
3477 |
+
"output_type": "display_data"
|
3478 |
+
},
|
3479 |
+
{
|
3480 |
+
"name": "stdout",
|
3481 |
+
"output_type": "stream",
|
3482 |
+
"text": [
|
3483 |
+
"(168, 31)\n",
|
3484 |
+
"(168,)\n"
|
3485 |
+
]
|
3486 |
+
}
|
3487 |
+
],
|
3488 |
+
"source": [
|
3489 |
+
"from sklearn.linear_model import LinearRegression\n",
|
3490 |
+
"\n",
|
3491 |
+
"X = new.loc[:,['hour', 'day']]\n",
|
3492 |
+
"y = new.loc[:,'vehicle']\n",
|
3493 |
+
"n = pd.get_dummies(X)\n",
|
3494 |
+
"display(n.head())\n",
|
3495 |
+
"print(n.shape)\n",
|
3496 |
+
"print(y.shape)"
|
3497 |
+
]
|
3498 |
+
},
|
3499 |
+
{
|
3500 |
+
"cell_type": "code",
|
3501 |
+
"execution_count": 15,
|
3502 |
+
"id": "b6adf1cf",
|
3503 |
+
"metadata": {},
|
3504 |
+
"outputs": [
|
3505 |
+
{
|
3506 |
+
"name": "stdout",
|
3507 |
+
"output_type": "stream",
|
3508 |
+
"text": [
|
3509 |
+
"0.8552520624553817\n"
|
3510 |
+
]
|
3511 |
+
}
|
3512 |
+
],
|
3513 |
+
"source": [
|
3514 |
+
"reg = LinearRegression().fit(n,y)\n",
|
3515 |
+
"print(reg.score(n,y))\n",
|
3516 |
+
"y_pred = reg.predict(n)\n",
|
3517 |
+
"\n",
|
3518 |
+
"new_pred = []\n",
|
3519 |
+
"for i in y_pred:\n",
|
3520 |
+
" if i < 0:\n",
|
3521 |
+
" new_pred.append(0)\n",
|
3522 |
+
" else:\n",
|
3523 |
+
" new_pred.append(i)\n"
|
3524 |
+
]
|
3525 |
+
},
|
3526 |
+
{
|
3527 |
+
"cell_type": "code",
|
3528 |
+
"execution_count": 16,
|
3529 |
+
"id": "4fb37621",
|
3530 |
+
"metadata": {},
|
3531 |
+
"outputs": [],
|
3532 |
+
"source": [
|
3533 |
+
"import sklearn.metrics as metrics\n",
|
3534 |
+
"def regression_results(y_true, y_pred):\n",
|
3535 |
+
"\n",
|
3536 |
+
" # Regression metrics\n",
|
3537 |
+
" explained_variance=metrics.explained_variance_score(y_true, y_pred)\n",
|
3538 |
+
" mean_absolute_error=metrics.mean_absolute_error(y_true, y_pred) \n",
|
3539 |
+
" mse=metrics.mean_squared_error(y_true, y_pred) \n",
|
3540 |
+
" mean_squared_log_error=metrics.mean_squared_log_error(y_true, y_pred)\n",
|
3541 |
+
" median_absolute_error=metrics.median_absolute_error(y_true, y_pred)\n",
|
3542 |
+
" r2=metrics.r2_score(y_true, y_pred)\n",
|
3543 |
+
"\n",
|
3544 |
+
" print('explained_variance: ', round(explained_variance,4)) \n",
|
3545 |
+
" print('mean_squared_log_error: ', round(mean_squared_log_error,4))\n",
|
3546 |
+
" print('r2: ', round(r2,4))\n",
|
3547 |
+
" print('MAE: ', round(mean_absolute_error,4))\n",
|
3548 |
+
" print('MSE: ', round(mse,4))\n",
|
3549 |
+
" print('RMSE: ', round(np.sqrt(mse),4))"
|
3550 |
+
]
|
3551 |
+
},
|
3552 |
+
{
|
3553 |
+
"cell_type": "code",
|
3554 |
+
"execution_count": 17,
|
3555 |
+
"id": "fc1bd361",
|
3556 |
+
"metadata": {},
|
3557 |
+
"outputs": [
|
3558 |
+
{
|
3559 |
+
"name": "stdout",
|
3560 |
+
"output_type": "stream",
|
3561 |
+
"text": [
|
3562 |
+
"explained_variance: 0.8567\n",
|
3563 |
+
"mean_squared_log_error: 0.3976\n",
|
3564 |
+
"r2: 0.8566\n",
|
3565 |
+
"MAE: 23.7455\n",
|
3566 |
+
"MSE: 1029.6179\n",
|
3567 |
+
"RMSE: 32.0877\n"
|
3568 |
+
]
|
3569 |
+
}
|
3570 |
+
],
|
3571 |
+
"source": [
|
3572 |
+
"regression_results(y, new_pred)"
|
3573 |
+
]
|
3574 |
+
},
|
3575 |
+
{
|
3576 |
+
"cell_type": "code",
|
3577 |
+
"execution_count": null,
|
3578 |
+
"id": "49a4d65d",
|
3579 |
+
"metadata": {},
|
3580 |
+
"outputs": [],
|
3581 |
+
"source": []
|
3582 |
+
}
|
3583 |
+
],
|
3584 |
+
"metadata": {
|
3585 |
+
"kernelspec": {
|
3586 |
+
"display_name": "Python 3 (ipykernel)",
|
3587 |
+
"language": "python",
|
3588 |
+
"name": "python3"
|
3589 |
+
},
|
3590 |
+
"language_info": {
|
3591 |
+
"codemirror_mode": {
|
3592 |
+
"name": "ipython",
|
3593 |
+
"version": 3
|
3594 |
+
},
|
3595 |
+
"file_extension": ".py",
|
3596 |
+
"mimetype": "text/x-python",
|
3597 |
+
"name": "python",
|
3598 |
+
"nbconvert_exporter": "python",
|
3599 |
+
"pygments_lexer": "ipython3",
|
3600 |
+
"version": "3.8.16"
|
3601 |
+
}
|
3602 |
+
},
|
3603 |
+
"nbformat": 4,
|
3604 |
+
"nbformat_minor": 5
|
3605 |
+
}
|
src/basic_plot.py
CHANGED
@@ -13,10 +13,10 @@ def basic_chart(counts_df):
|
|
13 |
counts_df['hour'] = counts_df['datetime'].dt.strftime('%H')
|
14 |
|
15 |
# plot types
|
16 |
-
plot = st.
|
17 |
|
18 |
# view types
|
19 |
-
view = st.
|
20 |
filtered_views = counts_df[counts_df['view'] == view]
|
21 |
|
22 |
# conditional views
|
|
|
13 |
counts_df['hour'] = counts_df['datetime'].dt.strftime('%H')
|
14 |
|
15 |
# plot types
|
16 |
+
plot = st.selectbox('Choose Plot', options=['Day','Hour','Raw'])
|
17 |
|
18 |
# view types
|
19 |
+
view = st.selectbox('Choose View', options=counts_df['view'].unique())
|
20 |
filtered_views = counts_df[counts_df['view'] == view]
|
21 |
|
22 |
# conditional views
|
src/heatmap.py
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import pandas as pd
|
3 |
+
import matplotlib.pyplot as plt
|
4 |
+
import scipy as sp
|
5 |
+
import sklearn as sk
|
6 |
+
import plotly.express as px
|
7 |
+
from plotly.subplots import make_subplots
|
8 |
+
import plotly.graph_objects as go
|
9 |
+
import streamlit as st
|
10 |
+
|
11 |
+
|
12 |
+
def clean_data(df):
|
13 |
+
|
14 |
+
df["date"] = pd.to_datetime(df["date"], format="%Y-%m-%d")
|
15 |
+
df["day"] = df["date"].dt.day_name()
|
16 |
+
df["hour"] = df["time"].str[:2] + ":00"
|
17 |
+
df.drop(columns=["motorcycle"], axis=1, inplace=True)
|
18 |
+
df["vehicle"] = df["car"] + df["large_vehicle"]
|
19 |
+
|
20 |
+
return df
|
21 |
+
|
22 |
+
|
23 |
+
class HeatMap:
|
24 |
+
def __init__(self, counts_df):
|
25 |
+
self.df = clean_data(counts_df)
|
26 |
+
new = (
|
27 |
+
self.df.groupby(["hour", "day"])
|
28 |
+
.sum()
|
29 |
+
.drop(columns=["car", "large_vehicle"])
|
30 |
+
.reset_index()
|
31 |
+
)
|
32 |
+
table = pd.pivot_table(
|
33 |
+
new, values="vehicle", index=["day"], columns=["hour"]
|
34 |
+
).reset_index()
|
35 |
+
self.table = table.reindex([1, 5, 6, 4, 0, 2, 3])
|
36 |
+
|
37 |
+
|
38 |
+
def vehicle_count_bar(self):
|
39 |
+
new_df = self.df.groupby(["day"]).sum().reset_index()
|
40 |
+
new_df = new_df.reindex([1, 5, 6, 4, 0, 2, 3])
|
41 |
+
|
42 |
+
veh_count_fig = px.bar(
|
43 |
+
new_df,
|
44 |
+
x="day",
|
45 |
+
y="vehicle",
|
46 |
+
color="day",
|
47 |
+
text_auto=True,
|
48 |
+
labels={"day": "Day of the Week", "vehicle": "Vehicle Count"},
|
49 |
+
)
|
50 |
+
|
51 |
+
return veh_count_fig
|
52 |
+
|
53 |
+
def heatmap(self):
|
54 |
+
|
55 |
+
new_table = self.table.iloc[:, 1:].to_numpy()
|
56 |
+
|
57 |
+
hm_fig = px.imshow(
|
58 |
+
new_table,
|
59 |
+
labels=dict(
|
60 |
+
x="Hour of the Day", y="Day of the Week", color="Causeway Traffic"
|
61 |
+
),
|
62 |
+
x=[
|
63 |
+
"12am",
|
64 |
+
"1am",
|
65 |
+
"2am",
|
66 |
+
"3am",
|
67 |
+
"4am",
|
68 |
+
"5am",
|
69 |
+
"6am",
|
70 |
+
"7am",
|
71 |
+
"8am",
|
72 |
+
"9am",
|
73 |
+
"10am",
|
74 |
+
"11am",
|
75 |
+
"12pm",
|
76 |
+
"1pm",
|
77 |
+
"2pm",
|
78 |
+
"3pm",
|
79 |
+
"4pm",
|
80 |
+
"5pm",
|
81 |
+
"6pm",
|
82 |
+
"7pm",
|
83 |
+
"8pm",
|
84 |
+
"9pm",
|
85 |
+
"10pm",
|
86 |
+
"11pm",
|
87 |
+
],
|
88 |
+
y=[
|
89 |
+
"Monday",
|
90 |
+
"Tuesday",
|
91 |
+
"Wednesday",
|
92 |
+
"Thursday",
|
93 |
+
"Friday",
|
94 |
+
"Saturday",
|
95 |
+
"Sunday",
|
96 |
+
],
|
97 |
+
text_auto=True,
|
98 |
+
)
|
99 |
+
hm_fig.update_xaxes(side="top")
|
100 |
+
|
101 |
+
return hm_fig
|
102 |
+
|
103 |
+
def update_hour_bar_chart(self, hour="08:00"):
|
104 |
+
|
105 |
+
fig_hours = px.bar(
|
106 |
+
self.table,
|
107 |
+
x="day",
|
108 |
+
y=str(hour),
|
109 |
+
color="day",
|
110 |
+
text_auto=True,
|
111 |
+
labels={"day": "Day of the Week"},
|
112 |
+
)
|
113 |
+
return fig_hours
|
114 |
+
|
115 |
+
def update_day_bar_chart(self, day="Saturday"):
|
116 |
+
|
117 |
+
t = self.table.T
|
118 |
+
t.drop("day", inplace=True)
|
119 |
+
t.columns = [
|
120 |
+
"Monday",
|
121 |
+
"Tuesday",
|
122 |
+
"Wednesday",
|
123 |
+
"Thursday",
|
124 |
+
"Friday",
|
125 |
+
"Saturday",
|
126 |
+
"Sunday",
|
127 |
+
]
|
128 |
+
t = t.reset_index()
|
129 |
+
|
130 |
+
fig_days = px.bar(
|
131 |
+
t,
|
132 |
+
x="hour",
|
133 |
+
y=str(day),
|
134 |
+
color=str(day),
|
135 |
+
text_auto=True,
|
136 |
+
labels={"hour": "Count of Each Hour"},
|
137 |
+
)
|
138 |
+
|
139 |
+
return fig_days
|