Skip to content

Commit

Permalink
Merge pull request #1346 from cal-itp/nov_ntd_ridership
Browse files Browse the repository at this point in the history
nov 2024 ntd monthly ridership publish
  • Loading branch information
csuyat-dot authored Jan 14, 2025
2 parents f6a10d1 + 053734a commit de9b753
Show file tree
Hide file tree
Showing 29 changed files with 133 additions and 109 deletions.
133 changes: 78 additions & 55 deletions ntd/explore_new_dim_monthly_ridership.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
},
{
"cell_type": "code",
"execution_count": 9,
"id": "4f1c721b-f3f9-4e87-a189-044ad256a4b4",
"execution_count": 3,
"id": "941e7515-1e9d-4e98-8d95-7fab98b24e94",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -96,13 +96,36 @@
"\n",
"full_upt = (tbls.mart_ntd.dim_monthly_ridership_with_adjustments() >> collect()).rename(columns = {\"mode_type_of_service_status\": \"Status\",\"primary_uza_name\":\"uza_name\"})\n",
" \n",
"full_upt = full_upt[full_upt.agency.notna()].reset_index(drop=True)\n",
"\n"
"full_upt = full_upt[full_upt.agency.notna()].reset_index(drop=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "82c6b5a4-b051-4202-99c7-eca037e33e8e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['2024-01', '2024-02', '2024-03', '2024-04', '2024-05', '2024-06',\n",
" '2024-07', '2024-08', '2024-09', '2024-10', '2024-11'],\n",
" dtype=object)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# double check to see what month this table goes too.\n",
"full_upt[full_upt[\"period_year_month\"].str.contains(\"2024-\")][\"period_year_month\"].sort_values().unique()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 4,
"id": "75e54dfc-98a6-4682-9bc0-a738ba13e636",
"metadata": {},
"outputs": [
Expand All @@ -111,34 +134,34 @@
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 630474 entries, 0 to 630473\n",
"RangeIndex: 633050 entries, 0 to 633049\n",
"Data columns (total 22 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 key 630474 non-null object \n",
" 1 ntd_id 630474 non-null object \n",
" 2 legacy_ntd_id 606910 non-null object \n",
" 3 agency 630474 non-null object \n",
" 4 reporter_type 630474 non-null object \n",
" 5 period_year_month 630474 non-null object \n",
" 6 period_year 630474 non-null object \n",
" 7 period_month 630474 non-null object \n",
" 8 uza_name 628830 non-null object \n",
" 9 primary_uza_code 628830 non-null object \n",
" 10 _3_mode 630474 non-null object \n",
" 11 mode 630474 non-null object \n",
" 12 mode_name 629926 non-null object \n",
" 13 service_type 630474 non-null object \n",
" 14 Status 630474 non-null object \n",
" 15 tos 630474 non-null object \n",
" 16 upt 339058 non-null float64 \n",
" 17 vrm 340270 non-null float64 \n",
" 18 vrh 340257 non-null float64 \n",
" 19 voms 342043 non-null float64 \n",
" 20 _dt 630474 non-null object \n",
" 21 execution_ts 630474 non-null datetime64[ns, UTC]\n",
" 0 key 633050 non-null object \n",
" 1 ntd_id 633050 non-null object \n",
" 2 legacy_ntd_id 609400 non-null object \n",
" 3 agency 633050 non-null object \n",
" 4 reporter_type 633050 non-null object \n",
" 5 period_year_month 633050 non-null object \n",
" 6 period_year 633050 non-null object \n",
" 7 period_month 633050 non-null object \n",
" 8 uza_name 631400 non-null object \n",
" 9 primary_uza_code 631400 non-null object \n",
" 10 _3_mode 633050 non-null object \n",
" 11 mode 633050 non-null object \n",
" 12 mode_name 632500 non-null object \n",
" 13 service_type 633050 non-null object \n",
" 14 Status 633050 non-null object \n",
" 15 tos 633050 non-null object \n",
" 16 upt 340446 non-null float64 \n",
" 17 vrm 341658 non-null float64 \n",
" 18 vrh 341645 non-null float64 \n",
" 19 voms 343431 non-null float64 \n",
" 20 _dt 633050 non-null object \n",
" 21 execution_ts 633050 non-null datetime64[ns, UTC]\n",
"dtypes: datetime64[ns, UTC](1), float64(4), object(17)\n",
"memory usage: 105.8+ MB\n"
"memory usage: 106.3+ MB\n"
]
}
],
Expand All @@ -148,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 5,
"id": "1d9a8149-b216-4da9-a210-e2ae68c56a15",
"metadata": {},
"outputs": [
Expand All @@ -157,34 +180,34 @@
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 95352 entries, 0 to 95351\n",
"RangeIndex: 95700 entries, 0 to 95699\n",
"Data columns (total 22 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 key 95352 non-null object \n",
" 1 ntd_id 95352 non-null object \n",
" 2 legacy_ntd_id 89872 non-null object \n",
" 3 agency 95352 non-null object \n",
" 4 reporter_type 95352 non-null object \n",
" 5 period_year_month 95352 non-null object \n",
" 6 period_year 95352 non-null object \n",
" 7 period_month 95352 non-null object \n",
" 8 uza_name 95352 non-null object \n",
" 9 primary_uza_code 95352 non-null object \n",
" 10 _3_mode 95352 non-null object \n",
" 11 mode 95352 non-null object \n",
" 12 mode_name 95352 non-null object \n",
" 13 service_type 95352 non-null object \n",
" 14 Status 95352 non-null object \n",
" 15 tos 95352 non-null object \n",
" 16 upt 51956 non-null float64 \n",
" 17 vrm 52114 non-null float64 \n",
" 18 vrh 52114 non-null float64 \n",
" 19 voms 52318 non-null float64 \n",
" 20 _dt 95352 non-null object \n",
" 21 execution_ts 95352 non-null datetime64[ns, UTC]\n",
" 0 key 95700 non-null object \n",
" 1 ntd_id 95700 non-null object \n",
" 2 legacy_ntd_id 90200 non-null object \n",
" 3 agency 95700 non-null object \n",
" 4 reporter_type 95700 non-null object \n",
" 5 period_year_month 95700 non-null object \n",
" 6 period_year 95700 non-null object \n",
" 7 period_month 95700 non-null object \n",
" 8 uza_name 95700 non-null object \n",
" 9 primary_uza_code 95700 non-null object \n",
" 10 _3_mode 95700 non-null object \n",
" 11 mode 95700 non-null object \n",
" 12 mode_name 95700 non-null object \n",
" 13 service_type 95700 non-null object \n",
" 14 Status 95700 non-null object \n",
" 15 tos 95700 non-null object \n",
" 16 upt 52155 non-null float64 \n",
" 17 vrm 52313 non-null float64 \n",
" 18 vrh 52313 non-null float64 \n",
" 19 voms 52517 non-null float64 \n",
" 20 _dt 95700 non-null object \n",
" 21 execution_ts 95700 non-null datetime64[ns, UTC]\n",
"dtypes: datetime64[ns, UTC](1), float64(4), object(17)\n",
"memory usage: 16.0+ MB\n"
"memory usage: 16.1+ MB\n"
]
}
],
Expand Down Expand Up @@ -2968,7 +2991,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
3 changes: 2 additions & 1 deletion ntd/ntd_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ def get_public_filename(monthyear_string: str) -> str:
"jul2024": "2024-09",
"aug2024": "2024-10",
"sep2024": "2024-11",
"oct2024": "2024-12"
"oct2024": "2024-12",
"nov2024": "2025-01",
}
2 changes: 1 addition & 1 deletion ntd/update_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

GCS_FILE_PATH = "gs://calitp-analytics-data/data-analyses/ntd/"

current_month = "oct2024"
current_month = "nov2024"
YEAR, MONTH = ntd_dates.parse_monthyear_string(current_month)
PUBLIC_FILENAME = ntd_dates.get_public_filename(current_month)
MONTH_CREATED = ntd_dates.DATES[current_month]
Expand Down
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown

0 comments on commit de9b753

Please sign in to comment.