Skip to content

Commit c9b329a

Browse files
committed
Merge only on OD cols
1 parent c1e44bb commit c9b329a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

data/src/utils/times.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,11 @@ def many_to_many(self, second_pass: bool = True) -> pd.DataFrame:
608608
missing.reset_index(), "origin_id", "destination_id"
609609
)
610610

611-
# Merge missing sets that overlap significantly (think two origins
612-
# that share 1000 destinations but not the 1001st)
611+
# Merge missing sets of OD pairs that overlap significantly (think
612+
# two origins that share 1000 destinations but not the 1001st)
613+
missing_sets = [
614+
df[["origin_id", "destination_id"]] for df in missing_sets
615+
]
613616
merged_sets = merge_overlapping_df_list(missing_sets, 0.8)
614617

615618
# Gut check that both sets contain the same number of rows
@@ -622,12 +625,12 @@ def many_to_many(self, second_pass: bool = True) -> pd.DataFrame:
622625
"The total number of rows in missing_sets does not"
623626
"match the total number of rows in merged_sets"
624627
)
628+
625629
self.config.logger.info(
626630
"Found %s unique missing sets. Merged to %s sets",
627631
len(missing_sets),
628632
len(merged_sets),
629633
)
630-
631634
for idx, missing_set in enumerate(merged_sets):
632635
self.config.logger.info("Routing missing set number %s", idx)
633636
o_ids = missing_set["origin_id"].unique()

0 commit comments

Comments
 (0)