Skip to content

Instantly share code, notes, and snippets.

Rank Team Player Average Gold Diff @ 10
1st Team Vitality Alphari 327
2nd Rogue Odoamne 189
3rd G2 Esports Broken Blade 102
4th Excel Esports Finn -26
5th Fnatic Wunder -44
6th SK Gaming Jenax -58
7th Team BDS Adam -69
8th Misfits Gaming HiRit -119
9th Astralis WhiteKnight -142
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Rank Team Player Average Gold Diff @ 10
1st Team Vitality Alphari 327
2nd Rogue Odoamne 189
3rd G2 Esports Broken Blade 102
4th Excel Esports Finn -26
5th Fnatic Wunder -44
6th SK Gaming Jenax -58
7th Team BDS Adam -69
8th Misfits Gaming HiRit -119
9th Astralis WhiteKnight -142
# An aggregation dictionary allows you to do the mean for some values, and a sum for others.
# In our case we want to the average of all the columns, but count the number of games per champion
agg_dict = {'LaneType': 'count'}
for col in df.columns[4:]:
agg_dict[col] = 'mean'
avg_champ_df = df.groupby(['Lane', 'Champion']).agg(agg_dict).reset_index()
avg_champ_df = avg_champ_df[avg_champ_df['Count'] >= 5000]
top_champ_df = avg_champ_df[avg_champ_df['Lane'] == 'top']
avg_champ_df = avg_champ_df[avg_champ_df['Count']>=5000]
top_champ_df = avg_champ_df[avg_champ_df['Lane']=='top']
def normalization(row):
x_min, x_max = np.max(row), np.min(row)
return [(x - x_min) / (x_max - x_min) for x in row]
list_of_stats = [normalization(list(top_champ_df[x])) for x in stats]
# Initially it starts column-wise, (i.e. each list contains 1 stat across all champs)
XT = np.array(list_of_stats)
# So we transpose it to row-wise (i.e. each list contains all stats for 1 champ)
X = np.transpose(XT)
def normalization(row):
row = [np.log(x) for x in row]
x_min, x_max = np.max(row), np.min(row)
return [(x - x_min) / (x_max - x_min) for x in row]
list_of_stats = [normalization(list(top_champ_df[x])) for x in stats]
XT = np.array(list_of_stats)
X = np.transpose(XT)
def normalization(row):
row = [np.log(x) for x in row]
x_min, x_max = np.max(row), np.min(row)
return [(x - x_min) / (x_max - x_min) for x in row]
list_of_stats = [normalization(list(lane[x])) for x in questions.values()]
XT = np.array(list_of_stats)
X = np.transpose(XT)
def score_likelihood(decrypted_text, perc_dict):
total_likelihood = 0
for i in range(len(decrypted_text) - 1):
pair_likelihood = perc_dict[decrypted_text[i]][decrypted_text[i+1]]
total_likelihood += pair_likelihood
return total_likelihood
def shuffle_pair(current_dict):
a, b = random.sample(current_dict.keys(), 2)
proposed_dict = current_dict.copy()