From 5bdb4be122e1b0aedebc59691a940a47975b6123 Mon Sep 17 00:00:00 2001 From: threnjen Date: Mon, 16 Dec 2024 18:51:25 -0800 Subject: [PATCH] make ratings_df and games_df smaller before merging to main df --- modules/rag_description_generation/main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/rag_description_generation/main.py b/modules/rag_description_generation/main.py index ebf426d..c9d97d1 100644 --- a/modules/rag_description_generation/main.py +++ b/modules/rag_description_generation/main.py @@ -85,14 +85,17 @@ def merge_game_df_with_ratings_df(self, game_df_reduced): file_name="ratings_data.pkl", ) ratings_df["BGGId"] = ratings_df["BGGId"].astype("string") + ratings_df = ratings_df[["username", "BGGId", "rating"]] + + game_df_reduced = game_df_reduced[ + ["BGGId", "Name", "Description", "AvgRating", "BayesAvgRating"] + ] print( f"Reducing user ratings to only include games in the reduced game dataframe\n" ) all_games_df = ratings_df.merge( - game_df_reduced[ - ["BGGId", "Name", "Description", "AvgRating", "BayesAvgRating"] - ], + game_df_reduced, on="BGGId", how="inner", )