From 2e00bc0f46ea969568a70fcbc07cc63f87e708aa Mon Sep 17 00:00:00 2001 From: DavidOry Date: Wed, 13 Mar 2024 16:18:31 -0400 Subject: [PATCH] fix double counting of observed boardings by time of day --- tm2py/acceptance/observed.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tm2py/acceptance/observed.py b/tm2py/acceptance/observed.py index 0a15711d..3bd79c2f 100644 --- a/tm2py/acceptance/observed.py +++ b/tm2py/acceptance/observed.py @@ -161,6 +161,8 @@ def __init__( if not on_board_assign_summary: self._validate() + elif on_board_assign_summary: + self._reduce_observed_rail_access_summaries() def _validate(self): @@ -298,14 +300,10 @@ def _join_standard_route_id(self, input_df: pd.DataFrame) -> pd.DataFrame: how="left", left_on=["survey_operator", "survey_route", "time_period"], right_on=["survey_agency", "survey_route", "time_period"], - ) + ) # observed records are not by direction, so we need to scale the boardings by 2 - time_of_day_df["survey_boardings"] = np.where( - time_of_day_df["survey_operator"] == time_of_day_df["survey_route"], - time_of_day_df["survey_boardings"], - time_of_day_df["survey_boardings"] / 2.0, - ) + time_of_day_df["survey_boardings"] = np.where(time_of_day_df["survey_operator"] == time_of_day_df["survey_route"], time_of_day_df["survey_boardings"], time_of_day_df["survey_boardings"]/2.0) return pd.concat([all_df, time_of_day_df], axis="rows", ignore_index=True)