<jupyter_start><jupyter_text>M2 Task5:  From EDA, we can tell that the game is fair; both sides have about the same chance to win the game at start. RQ1: Does the team takes the first blood has more chance to win? RQ2: Does the team takes the first Baron has more chance to win?(Keep in mind that many games end without first Baron) RQ3: Does the team takes the first dragon has more chance to win? RQ4: What is relationship between team KDA and chance to win? RQ5: What is relationship between two team's total champion damage difference and chance to win? RQ6: What is relationship between two team's total heal difference and chance to win?<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

from scripts import project_functions 
df = project_functions.load_and_process('../data/raw/Master_Ranked_Games.csv')
df.head()
df1 = df.assign(temp1= lambda x: np.where(x.teamFirstBlood==x.teamWins,True,False))
sns.countplot(data=df1, y='temp1').set_title('Team with first blood wins')
plt.ylabel('')<jupyter_output><empty_output><jupyter_text>Team with the first blood do have a clear more times to win the game. But the chance doesn't differ **very** much.<jupyter_code>df2 = df.assign(temp2= lambda x: np.where((x.teamFirstBaron!='noTeam')&(x.teamFirstBaron==x.teamWins),
                                          'True',np.where((x.teamFirstBaron!='noTeam'),'False','noTeam')))
sns.countplot(data=df2, y='temp2').set_title('Team with first Baron wins')
plt.ylabel('')<jupyter_output><empty_output><jupyter_text>According to the plot, if a team takes the first Baron, it is very likely to win the game. It may either because the 'better' team is easier to get first Baron or the first Baron gives that team very strong buff. But the relationship exists anyway.<jupyter_code>df3 = df.assign(temp3= lambda x: np.where((x.teamFirstDragon!='noTeam')&(x.teamFirstDragon==x.teamWins),
                                          'True',np.where((x.teamFirstDragon!='noTeam'),'False','noTeam')))
sns.countplot(data=df3, y='temp3').set_title('Team with first dragon wins')
plt.ylabel('')<jupyter_output><empty_output><jupyter_text>According to the plot, if a team takes the first dragon, it is also more likely to win the game, but the chance difference is smaller than the "first Baron's." This one's is about 5.2/3 where first Baron is about 4.4/0.9 and first blood is about 5.2/3.5.<jupyter_code>sns.displot(df, x="blueKDA", y="teamWins",aspect=3)
sns.displot(df, x="redKDA", y="teamWins",aspect=3)<jupyter_output><empty_output><jupyter_text>According to the plot, as a team's KDA goes higher, that team is more likely to win. But, there are times that a team losses with high KDA(In plots, there are lines for the opposite team when the team KDA is high). Generally speaking, looking at two darkest area, those teams who win the game usually have a KDA larger than 2, ortherwise, teams are more likely to lose.<jupyter_code>#We are using blue's-red's
df5 = df.assign(dmgD= df['blueChampionDamageDealt']-df['redChampionDamageDealt'])
sns.displot(df5, x="dmgD", y="teamWins",aspect=3)<jupyter_output><empty_output><jupyter_text>According to the plot, the team who wins usually has higher damage than the other team(dark area). But there are also many cases that a team wins without higher damage.<jupyter_code>#We are using blue's-red's
df6 = df.assign(healD= df['blueTotalHeal']-df['redTotalHeal'])
sns.displot(df6, x="healD", y="teamWins",aspect=4)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10745676212078253, 'fraction_numerical': 0.011341083073433513, 'mean_word_length': 5.25531914893617, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '646383', 'license': 'MIT', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1119, 'n_words': 404, 'path': 'analysis/backup/Milestone2_Task5.ipynb', 'repo_name': 'data301-2020-winter2/course-project-solo_116', 'size': '3527'}