Spaces:
Sleeping
Sleeping
Jimin Park
commited on
Commit
·
674aeed
1
Parent(s):
977e16e
kermitting soon
Browse files- util/helper.py +3 -10
util/helper.py
CHANGED
@@ -901,12 +901,12 @@ def calculate_role_specialization(df):
|
|
901 |
return df
|
902 |
|
903 |
def calculate_champion_loyalty(df):
|
904 |
-
print("========================== Inside: calculate_champion_loyalty ====================\n")
|
905 |
df = df.copy()
|
906 |
print("df.dtypes: \n", df.dtypes, "\n")
|
907 |
|
908 |
|
909 |
def get_loyalty_scores(row):
|
|
|
910 |
try:
|
911 |
|
912 |
# Get champions lists, handle potential NaN/None values (only top 2)
|
@@ -944,20 +944,13 @@ def calculate_champion_loyalty(df):
|
|
944 |
**champ_loyalty_flags
|
945 |
}
|
946 |
|
947 |
-
# Calculate games played for recent champions (only top 2)
|
948 |
-
#print("START calculate games played for recent champions (only top 2)...\n")
|
949 |
-
# print("row['W_1'] type: ", type(row['W_1']), "\n row['W_1']: ", row['W_1'], "\n ")
|
950 |
-
# print("row['L_1'] type: ", type(row['L_1']), "\n row['L_1']: ", row['L_1'], "\n")
|
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 |
print(f"season_games was: {season_games}, types: {[type(x) for x in season_games]}")
|
963 |
|
|
|
901 |
return df
|
902 |
|
903 |
def calculate_champion_loyalty(df):
|
|
|
904 |
df = df.copy()
|
905 |
print("df.dtypes: \n", df.dtypes, "\n")
|
906 |
|
907 |
|
908 |
def get_loyalty_scores(row):
|
909 |
+
print("========================== Inside: get_loyalty_scores() ====================\n")
|
910 |
try:
|
911 |
|
912 |
# Get champions lists, handle potential NaN/None values (only top 2)
|
|
|
944 |
**champ_loyalty_flags
|
945 |
}
|
946 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
947 |
recent_games = [
|
948 |
(int(row['W_1']) + int(row['L_1'])) if pd.notna(row['most_champ_1']) else 0,
|
949 |
(int(row['W_2']) + int(row['L_2'])) if pd.notna(row['most_champ_2']) else 0
|
950 |
]
|
951 |
|
952 |
+
season_games = [int(x) if isinstance(x, str) and x.isdigit() else 0 for x in season_games]
|
953 |
+
|
954 |
print(f"recent_games was: {recent_games}, types: {[type(x) for x in recent_games]}")
|
955 |
print(f"season_games was: {season_games}, types: {[type(x) for x in season_games]}")
|
956 |
|