-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgames.py
More file actions
31 lines (24 loc) · 1.41 KB
/
Copy pathgames.py
File metadata and controls
31 lines (24 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pandas as pd
useful_game_info = pd.read_csv("Datasets/useful_game_info.csv")
index_df = pd.read_csv("Datasets/game_indexes.csv")
def get_same_genre(game_name, opinion_factored=True, verbose=False):
same_genre = []
game_genre = useful_game_info.iloc[index_df[game_name][0]]["genre"].split(",")[0]
if opinion_factored:
opinion_dict = {"Overwhelmingly Positive": 2, "Very Positive": 1.5, "Mostly Positive": 1, "Positive":1, "Mixed":0, "Negative":-1, "Very Negative":-1, "Mostly Negative":-1, "Overwhelmingly Negative":-1}
for i in range(len(useful_game_info["name"])):
current_genre = useful_game_info.iloc[i]["genre"].split(",")[0]
if current_genre == game_genre:
game = useful_game_info.iloc[i]["name"]
if opinion_factored:
opinion = useful_game_info.iloc[i]["all_reviews"].split(",")[0]
if opinion in opinion_dict and opinion_dict[opinion] >= 1:
same_genre.append(game)
if verbose:
print(f"We got a match! {game} is same genre as {game_name} and have {opinion} reviews")
else:
same_genre.append(game)
if verbose:
print(f"We got a match! {game} is same genre as {game_name}, the genre is {current_genre}")
return same_genre
print(get_same_genre("Life is Strange 2", opinion_factored=True, verbose=True))