Spaces:
Sleeping
Sleeping
Jimin Park
commited on
Commit
·
f878a08
1
Parent(s):
e9fb72e
kermitting soon
Browse files- util/helper.py +6 -8
util/helper.py
CHANGED
@@ -908,11 +908,6 @@ def calculate_champion_loyalty(df):
|
|
908 |
|
909 |
def get_loyalty_scores(row):
|
910 |
try:
|
911 |
-
# Convert potentially non-numeric values to numbers !!!!!!!!!!!!!! chatGPT EDITED
|
912 |
-
# row['W_1'] = pd.to_numeric(row['W_1'], errors='coerce') if 'W_1' in row else 0
|
913 |
-
# row['L_1'] = pd.to_numeric(row['L_1'], errors='coerce') if 'L_1' in row else 0
|
914 |
-
# row['W_2'] = pd.to_numeric(row['W_2'], errors='coerce') if 'W_2' in row else 0
|
915 |
-
# row['L_2'] = pd.to_numeric(row['L_2'], errors='coerce') if 'L_2' in row else 0
|
916 |
|
917 |
# Get champions lists, handle potential NaN/None values (only top 2)
|
918 |
recent_champs = [
|
@@ -956,18 +951,21 @@ def calculate_champion_loyalty(df):
|
|
956 |
print(f"row['W_1'] value: {repr(row['W_1'])}, type: {type(row['W_1'])}")
|
957 |
print(f"row['L_1'] value: {repr(row['L_1'])}, type: {type(row['L_1'])}")
|
958 |
|
959 |
-
print(".... END calculate games played for recent champions (only top 2)\n")
|
960 |
|
961 |
recent_games = [
|
962 |
(int(row['W_1']) + int(row['L_1'])) if pd.notna(row['most_champ_1']) else 0,
|
963 |
(int(row['W_2']) + int(row['L_2'])) if pd.notna(row['most_champ_2']) else 0
|
964 |
]
|
|
|
965 |
print(f"recent_games was: {recent_games}, types: {[type(x) for x in recent_games]}")
|
966 |
|
967 |
-
print("Summing recent games... \n")
|
968 |
total_recent_games = sum(recent_games)
|
|
|
969 |
total_season_games = sum(season_games)
|
970 |
-
print("
|
|
|
971 |
|
972 |
if total_recent_games == 0:
|
973 |
return {
|
|
|
908 |
|
909 |
def get_loyalty_scores(row):
|
910 |
try:
|
|
|
|
|
|
|
|
|
|
|
911 |
|
912 |
# Get champions lists, handle potential NaN/None values (only top 2)
|
913 |
recent_champs = [
|
|
|
951 |
print(f"row['W_1'] value: {repr(row['W_1'])}, type: {type(row['W_1'])}")
|
952 |
print(f"row['L_1'] value: {repr(row['L_1'])}, type: {type(row['L_1'])}")
|
953 |
|
954 |
+
print(".... END calculate games played for recent champions (only top 2)\n \n \n")
|
955 |
|
956 |
recent_games = [
|
957 |
(int(row['W_1']) + int(row['L_1'])) if pd.notna(row['most_champ_1']) else 0,
|
958 |
(int(row['W_2']) + int(row['L_2'])) if pd.notna(row['most_champ_2']) else 0
|
959 |
]
|
960 |
+
|
961 |
print(f"recent_games was: {recent_games}, types: {[type(x) for x in recent_games]}")
|
962 |
|
963 |
+
print("\n \n Summing recent games... \n")
|
964 |
total_recent_games = sum(recent_games)
|
965 |
+
print("total_recent_games: ", total_recent_games, "\n")
|
966 |
total_season_games = sum(season_games)
|
967 |
+
print("total_season_games: ", total_season_games, "\n")
|
968 |
+
print("End of summing recent games... \n Total recent_games = ", total_recent_games, "\n total_season_games: ", total_season_games, "\n \n \n")
|
969 |
|
970 |
if total_recent_games == 0:
|
971 |
return {
|