Skip to content

Commit

Permalink
drop dangling fkey in user_friends table
Browse files Browse the repository at this point in the history
  • Loading branch information
yiweny committed Jul 23, 2024
1 parent ac6ac70 commit 5270a3f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions relbench/datasets/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ def make_db(self) -> Database:
user=lambda df: df["user"].astype(int),
friend=lambda df: df["friend"].astype(int),
)

# Some friends are not present in the user table, so we drop those friends
# in the user_friends table
user_friends_flattened_df = user_friends_flattened_df.merge(
users_df, how="inner", left_on="friend", right_on="user_id"
)
user_friends_flattened_df = user_friends_flattened_df[["user", "friend"]]
user_friends_flattened_df.to_csv(
os.path.join(path, "user_friends_flattened.csv")
)
Expand Down

0 comments on commit 5270a3f

Please sign in to comment.