def kill_difference(data):
    """
    Calcualte the average kills between winner teams and loser teams
    :param data: main data frame we are using
    :return: the average kills difference between winner teams and loser teams
    """
    winner = tools.winner_loser(data)[0]
    loser = tools.winner_loser(data)[1]
    win = winner.groupby("match_id")["kills"].mean()
    lose = loser.groupby("match_id")["kills"].mean()
    difference = (win - lose).mean()
    return round(difference)
def damage_graph(data, match):
    """
    Take data and match csv files
    Make damage difference plot for winning and losing team
    """
    x = np.array(match.loc[:9999, "match_id"])
    winner = tools.winner_loser(data)[0]
    loser = tools.winner_loser(data)[1]
    win = winner.groupby("match_id")["hero_damage"].mean()
    lose = loser.groupby("match_id")["hero_damage"].mean()
    y = (win - lose).to_list()
    y = np.array(y[:10000])
    data_new = pd.DataFrame(data={"x": x, "y": y})
    sns.relplot(x="x", y="y", data=data_new)
    plt.title("Damage difference in 10000 games")
    plt.xlabel("Matches ID")
    plt.ylabel("Damage difference")
    plt.savefig("user_files/image_files/plot3.png", bbox_inches="tight")