From 067f22ee3d00ff82073568dad5e5102ebf4d42da Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:04:52 -0700 Subject: [PATCH] use indices to check if any missing nodes --- network_wrangler/roadway/links/validate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/network_wrangler/roadway/links/validate.py b/network_wrangler/roadway/links/validate.py index cb560771..7456b9e1 100644 --- a/network_wrangler/roadway/links/validate.py +++ b/network_wrangler/roadway/links/validate.py @@ -19,8 +19,9 @@ def validate_links_have_nodes(links_df: pd.DataFrame, nodes_df: pd.DataFrame) -> raises: NodesInLinksMissingError if nodes_df is missing and A or B node """ nodes_in_links = list(set(links_df["A"]).union(set(links_df["B"]))) + node_idx_in_links = nodes_df[nodes_df["model_node_id"].isin(nodes_in_links)].index - fk_valid, fk_missing = fk_in_pk(nodes_df.index, nodes_in_links) + fk_valid, fk_missing = fk_in_pk(nodes_df.index, node_idx_in_links) if not fk_valid: msg = "Links are missing len{fk_missing} nodes." WranglerLogger.error(msg + f"\n Missing: {fk_missing}")