Skip to content

Commit

Permalink
Merge pull request #1320 from cal-itp/ntd_oct24
Browse files Browse the repository at this point in the history
oct 2024 monthly ntd ridership publish
  • Loading branch information
csuyat-dot authored Dec 10, 2024
2 parents a00dd68 + 875e101 commit 4f5156d
Show file tree
Hide file tree
Showing 30 changed files with 194 additions and 179 deletions.
244 changes: 125 additions & 119 deletions ntd/explore_new_dim_monthly_ridership.ipynb

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions ntd/monthly_ridership_by_rtpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ def save_rtpa_outputs(

(df[df["RTPA"] == i]
.sort_values("ntd_id")
#got error from excel not recognizing timezone, made list to include dropping "ts" column
.drop(columns = ["_merge","ts"])
#got error from excel not recognizing timezone, made list to include dropping "execution_ts" column
.drop(columns = [
"_merge",
"execution_ts"
])
#cleaning column names
.rename(columns=lambda x: x.replace("_"," ").title().strip())
#rename columns
Expand Down Expand Up @@ -184,7 +187,11 @@ def produce_ntd_monthly_ridership_by_rtpa(
merge in crosswalk, checks for unmerged rows, then creates new columns for full Mode and TOS name.
"""
full_upt = (tbls.mart_ntd.dim_monthly_ntd_ridership_with_adjustments() >> collect()).rename(columns = {"mode_type_of_service_status": "Status"})
full_upt = (tbls.mart_ntd.dim_monthly_ridership_with_adjustments() >> collect()).rename(
columns = {
"mode_type_of_service_status": "Status",
"primary_uza_name":"uza_name"
})

full_upt = full_upt[full_upt.agency.notna()].reset_index(drop=True)

Expand Down
8 changes: 5 additions & 3 deletions ntd/ntd_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def get_public_filename(monthyear_string: str) -> str:

DATES = {
# key is month of NTD data
# value is the month_updated in the url we're downloading from
# value is the month_updated in the url we're downloading from (2 months ahead from key)
# ex oct data is reported in december, so (oct20XX:"20XX-12")
"oct2023": "2023-12",
"nov2023": "2024-01",
"dec2023": "2024-02",
Expand All @@ -36,6 +37,7 @@ def get_public_filename(monthyear_string: str) -> str:
"may2024": "2024-07",
"jun2024": "2024-08",
"jul2024": "2024-09",
"aug2024": "2024-08",
"sep2024": "2024-09"
"aug2024": "2024-10",
"sep2024": "2024-11",
"oct2024": "2024-12"
}
4 changes: 2 additions & 2 deletions ntd/update_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

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

current_month = "sep2024"
current_month = "oct2024"
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]

# Check this url each month
# https://www.transit.dot.gov/ntd/data-product/monthly-module-adjusted-data-release
# Depending on if they fixed the Excel, there may be an additional suffix
suffix = "_241101"
suffix = "_241202"
FULL_URL = (
"https://www.transit.dot.gov/sites/fta.dot.gov/files/"
f"{MONTH_CREATED}/{MONTH}%20{YEAR}%20"
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 4f5156d

Please sign in to comment.