// turn the coordinates into a DataFrame indexed by u, v, k
cols = ["u", "v", "k", "u_y", "u_x", "v_y", "v_x"]
df = pd.DataFrame(coords, columns=cols).set_index(["u", "v", "k"])
// calculate great circle distances, fill nulls with zeros, then round
dists = distance.great_circle_vec(df["u_y"], df["u_x"], df["v_y"], df["v_x"])
After Change
raise KeyError(f"Edge(s) missing nodes {missing_str} possibly due to clipping issue")
df_coords = pd.DataFrame(coords, columns=["u", "v", "k", "u_y", "u_x", "v_y", "v_x"])
df_coords[["u", "v", "k"]] = df_coords[["u", "v", "k"]].astype(np.int64)
df_coords = df_coords.set_index(["u", "v", "k"])
// then calculate the great circle distance with the vectorized function
gc_distances = distance.great_circle_vec(