Skip to content

Commit

Permalink
fix double counting of observed boardings by time of day
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidOry committed Mar 13, 2024
1 parent 477eb2f commit 2e00bc0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tm2py/acceptance/observed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 2e00bc0

Please sign in to comment.