Skip to content

Commit

Permalink
add validation for merging
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Jul 1, 2024
1 parent 11b621c commit eec91f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/python/train_facility_attraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
visits = pd.read_csv(args.visitations)
mapping = pd.read_csv(args.mapping)

visits = pd.merge(visits, mapping, left_on="location", right_on="osm_id", how="inner")
visits = pd.merge(visits, mapping, left_on="location", right_on="osm_id", how="inner", validate="m:1")

# Aggregates all parent ids
visits = visits.groupby(["parent_id", "purpose"]).agg(n=("n", "sum")).reset_index().rename(
Expand All @@ -41,7 +41,7 @@

tf = visits[visits.purpose == purpose]

df = pd.merge(shp, tf, left_on="osm_id", right_on="location", how="inner")
df = pd.merge(shp, tf, left_on="osm_id", right_on="location", how="inner", validate="1:1")
df["target"] = df.n / df.area

# Drop outliers
Expand Down

0 comments on commit eec91f6

Please sign in to comment.