Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oct 2024 monthly ntd ridership publish #1320

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -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
@@ -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)

8 changes: 5 additions & 3 deletions ntd/ntd_dates.py
Original file line number Diff line number Diff line change
@@ -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",
@@ -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
@@ -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"
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
Loading