Skip to content

Commit

Permalink
Update NJSP plots
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams committed Sep 21, 2024
1 parent d6a3ee1 commit 1a5376f
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 68 deletions.
8 changes: 4 additions & 4 deletions njsp/data/year-type-county.csv
Original file line number Diff line number Diff line change
Expand Up @@ -335,18 +335,18 @@ year,county,driver,passenger,cyclist,pedestrian,crashes
2023,Sussex,6,2,0,1,6
2023,Union,14,6,2,15,35
2023,Warren,7,1,0,3,11
2024,Atlantic,20,1,2,14,36
2024,Atlantic,21,1,2,14,37
2024,Bergen,13,4,2,10,27
2024,Burlington,24,4,1,4,33
2024,Camden,13,3,0,11,27
2024,Cape May,4,0,0,0,4
2024,Cumberland,15,5,0,3,18
2024,Cumberland,16,5,0,3,19
2024,Essex,13,3,0,18,34
2024,Gloucester,12,3,0,2,16
2024,Hudson,6,2,0,3,10
2024,Hudson,7,2,0,3,11
2024,Hunterdon,3,2,0,2,7
2024,Mercer,12,5,0,8,24
2024,Middlesex,21,8,1,16,40
2024,Middlesex,22,8,1,16,41
2024,Monmouth,18,5,4,11,37
2024,Morris,7,0,1,5,13
2024,Ocean,21,4,1,11,35
Expand Down
122 changes: 64 additions & 58 deletions njsp/update-plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -261,36 +261,6 @@
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13439</th>\n",
" <td>12</td>\n",
" <td>25</td>\n",
" <td>2024-09-14 23:55:00-04:00</td>\n",
" <td>3</td>\n",
" <td>&lt;NA&gt;</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>Garden State Parkway MP 131.1</td>\n",
" <td>None</td>\n",
" <td>444</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13440</th>\n",
" <td>3</td>\n",
" <td>33</td>\n",
" <td>2024-09-15 12:32:00-04:00</td>\n",
" <td>1</td>\n",
" <td>&lt;NA&gt;</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>State Highway 206 MP 23.3</td>\n",
" <td>None</td>\n",
" <td>206</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13441</th>\n",
" <td>18</td>\n",
" <td>11</td>\n",
Expand Down Expand Up @@ -335,9 +305,39 @@
" <td>None</td>\n",
" <td>70</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13448</th>\n",
" <td>6</td>\n",
" <td>9</td>\n",
" <td>2024-09-20 11:41:00-04:00</td>\n",
" <td>1</td>\n",
" <td>&lt;NA&gt;</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>State Highway 347 MP 7.5</td>\n",
" <td>None</td>\n",
" <td>347</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13447</th>\n",
" <td>1</td>\n",
" <td>8</td>\n",
" <td>2024-09-20 23:32:00-04:00</td>\n",
" <td>1</td>\n",
" <td>&lt;NA&gt;</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>Betsy Scull Rd</td>\n",
" <td>Betsy Scull Rd</td>\n",
" <td>None</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>9418 rows \u00d7 12 columns</p>\n",
"<p>9422 rows \u00d7 12 columns</p>\n",
"</div>"
],
"text/plain": [
Expand All @@ -349,11 +349,11 @@
"1661 20 4 2008-01-01 12:29:00-05:00 1 1 <NA> <NA> <NA> <NA> \n",
"1811 7 16 2008-01-01 18:53:00-05:00 1 <NA> <NA> <NA> <NA> <NA> \n",
"... .. .. ... .. ... ... ... ... ... \n",
"13439 12 25 2024-09-14 23:55:00-04:00 3 <NA> 1 2 0 0 \n",
"13440 3 33 2024-09-15 12:32:00-04:00 1 <NA> 1 0 0 0 \n",
"13441 18 11 2024-09-15 17:33:00-04:00 1 <NA> 1 0 0 0 \n",
"13437 16 8 2024-09-16 00:04:00-04:00 1 <NA> 1 0 0 0 \n",
"13443 15 19 2024-09-18 22:41:00-04:00 1 <NA> 0 0 1 0 \n",
"13448 6 9 2024-09-20 11:41:00-04:00 1 <NA> 1 0 0 0 \n",
"13447 1 8 2024-09-20 23:32:00-04:00 1 <NA> 1 0 0 0 \n",
"\n",
" location street highway \n",
"id \n",
Expand All @@ -363,13 +363,13 @@
"1661 County 624 W MP 2.2 at Ikea Dr None 624 \n",
"1811 County 648 E MP .87 at Franklin Ave None 648 \n",
"... ... ... ... \n",
"13439 Garden State Parkway MP 131.1 None 444 \n",
"13440 State Highway 206 MP 23.3 None 206 \n",
"13441 County 533 None 533 \n",
"13437 Broadway Broadway None \n",
"13443 State Highway 70 None 70 \n",
"13448 State Highway 347 MP 7.5 None 347 \n",
"13447 Betsy Scull Rd Betsy Scull Rd None \n",
"\n",
"[9418 rows x 12 columns]"
"[9422 rows x 12 columns]"
]
},
"execution_count": 5,
Expand Down Expand Up @@ -402,7 +402,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Most recent NJSP run date: 2024-09-20 10:00:03-04:00\n",
"Most recent NJSP run date: 2024-09-21 10:00:02-04:00\n",
"Most recent month end: 2024-09-01 00:00:00-04:00\n",
"Current year start: 2024-01-01 00:00:00-05:00\n",
"Next year start: 2025-01-01 00:00:00-05:00\n"
Expand Down Expand Up @@ -649,12 +649,12 @@
"1661 2008-01\n",
"1811 2008-01\n",
" ... \n",
"13439 2024-09\n",
"13440 2024-09\n",
"13441 2024-09\n",
"13437 2024-09\n",
"13443 2024-09\n",
"Name: ym, Length: 9418, dtype: object"
"13448 2024-09\n",
"13447 2024-09\n",
"Name: ym, Length: 9422, dtype: object"
]
},
"execution_count": 13,
Expand Down Expand Up @@ -688,7 +688,7 @@
"2024-05 48\n",
"2024-06 64\n",
"2024-07 47\n",
"2024-08 62\n",
"2024-08 63\n",
"Name: tk, Length: 200, dtype: Int8"
]
},
Expand Down Expand Up @@ -734,7 +734,7 @@
"2024-05 54.666667\n",
"2024-06 55.000000\n",
"2024-07 54.833333\n",
"2024-08 55.000000\n",
"2024-08 55.083333\n",
"Name: tk, Length: 200, dtype: float64"
]
},
Expand Down Expand Up @@ -827,11 +827,11 @@
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>62</td>\n",
" <td>63</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>42</td>\n",
" <td>45</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
Expand All @@ -850,8 +850,8 @@
"2024 5 48\n",
" 6 64\n",
" 7 47\n",
" 8 62\n",
" 9 42\n",
" 8 63\n",
" 9 45\n",
"\n",
"[201 rows x 1 columns]"
]
Expand Down Expand Up @@ -1031,8 +1031,8 @@
"2024 5 48\n",
" 6 64\n",
" 7 47\n",
" 8 62\n",
" 9 42\n",
" 8 63\n",
" 9 45\n",
"Name: tk, Length: 201, dtype: Int8"
]
},
Expand Down Expand Up @@ -1351,7 +1351,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"705 projected deaths for 2024\n"
"704 projected deaths for 2024\n"
]
}
],
Expand Down Expand Up @@ -1552,12 +1552,12 @@
" </tr>\n",
" <tr>\n",
" <th>2024</th>\n",
" <td>253</td>\n",
" <td>257</td>\n",
" <td>142</td>\n",
" <td>58</td>\n",
" <td>18</td>\n",
" <td>705</td>\n",
" <td>234</td>\n",
" <td>704</td>\n",
" <td>229</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
Expand All @@ -1582,7 +1582,7 @@
"2021 368 217 86 26 697 0\n",
"2022 379 191 103 16 689 0\n",
"2023 319 173 88 26 606 0\n",
"2024 253 142 58 18 705 234"
"2024 257 142 58 18 704 229"
]
},
"execution_count": 23,
Expand Down Expand Up @@ -2384,7 +2384,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Wrote plot image to www/public/plots/fatalities_per_year_by_type.png\n",
"Wrote plot image to www/public/plots/fatalities_per_year_by_type.png\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Wrote plot image to www/public/plots/fatalities_per_year_by_type_titled.png\n"
]
}
Expand Down Expand Up @@ -2861,14 +2867,14 @@
" </tr>\n",
" <tr>\n",
" <th>2024-08</th>\n",
" <td>28</td>\n",
" <td>29</td>\n",
" <td>20</td>\n",
" <td>9</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2024-09</th>\n",
" <td>26</td>\n",
" <td>29</td>\n",
" <td>11</td>\n",
" <td>4</td>\n",
" <td>1</td>\n",
Expand Down Expand Up @@ -2935,8 +2941,8 @@
"2024-05 28 11 8 1\n",
"2024-06 37 15 7 5\n",
"2024-07 32 11 1 3\n",
"2024-08 28 20 9 5\n",
"2024-09 26 11 4 1"
"2024-08 29 20 9 5\n",
"2024-09 29 11 4 1"
]
},
"execution_count": 36,
Expand Down
Loading

0 comments on commit 1a5376f

Please sign in to comment.