Jimin Park commited on
Commit
0093d11
·
1 Parent(s): 4ed5bb1

kermitting soon

Browse files
Files changed (1) hide show
  1. util/helper.py +6 -0
util/helper.py CHANGED
@@ -908,6 +908,12 @@ def calculate_champion_loyalty(df):
908
 
909
  def get_loyalty_scores(row):
910
  try:
 
 
 
 
 
 
911
  # Get champions lists, handle potential NaN/None values (only top 2)
912
  recent_champs = [
913
  row['most_champ_1'] if pd.notna(row['most_champ_1']) else None,
 
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 = [
919
  row['most_champ_1'] if pd.notna(row['most_champ_1']) else None,