Skip to content

Instantly share code, notes, and snippets.

@azzarello
Created October 6, 2018 19:21
Show Gist options
  • Save azzarello/0403dc17aea8de077510a9e8557de3a0 to your computer and use it in GitHub Desktop.
Save azzarello/0403dc17aea8de077510a9e8557de3a0 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analyzing DOTA 2's TI8"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Purpose\n",
"My purpose in creating this project was to practice my newly acquired proficiency in the Python language, along with a few very common data science packages for the language. I chose to complete my first data analysis for a video game I have been in love with for the past 5 years, DOTA 2. DOTA 2 is categorized as a MOBA and is played on a computer. The game has over 10 million monthly players across the globe and has garnered a large viewership for its competitive events. Every August *The International* (DOTA 2's World Championships) is held with the 18 best teams in the world competing for a large prize pool. For the past five internationals the prize pool of the tournament has been crowd-funded, meaning that the player base contributes to the prize pool by purchasing in-game cosmetic items. The prize pool for this years International, TI8, was over $25 million.\n",
"\n",
"Throughout this analysis I performed get requests on the [OpenDota API](https://docs.opendota.com/) to access a multitude of data points related to the game. I performed this analysis across all 195 games of TI8, including both the tournament's group stage and main event LAN tournament, however I did not look at data from the qualifiers. This write-up assumes a surface level understanding of the game. If you would like to learn a little bit more about the game and have two minutes to spend, check out [This is DOTA](https://www.youtube.com/watch?v=Cp8neRiF9-k) published by the game's developer Valve Software. I hope you enjoy"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I began by importing all the necessary packages for this data analysis project. \n",
"In this first cell my personal API key for OpenDota's API is saved to a variable called api-key. \n",
"This API key will be useful if a large number of calls to the OpenDota API are required in quick succession (users without a key are only allowed to make 60 calls per minute)."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import requests\n",
"import json\n",
"import os.path\n",
"from pathlib2 import Path\n",
"import pickle\n",
"import time\n",
"\n",
"api_key = '?api_key=082df0c9-30cb-4351-8052-b3c709f22ba7'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next it was helpful to create a list consisting of the match ID numbers for every game played at The International 8. \n",
"This list was saved to a pickled file in order to save it for future use without needing to access the API repeatedly.\n",
"I also saved a pickled file that represents all the team matchups that occurred during the tournament. This was important to producing team-based statistics as the OpenDota API doesn't provide a team name and ID from a *matches* get request, only from the less useful *pro matches* call.\n",
"Note: This cell does not unpack the pickled file if it does actually exist, only creates it if it does not."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"file = Path('match_ids.pickle') \n",
"if not file.exists() :\n",
" cont = True\n",
" match_ids = []\n",
" matchups = {}\n",
" less_than_match = ''\n",
" while cont:\n",
" url = 'https://api.opendota.com/api/proMatches' + less_than_match\n",
"\n",
" r = requests.get(url)\n",
" json_data = r.json()\n",
"\n",
" for i in range(len(json_data)) :\n",
" if json_data[i].get('league_name') == 'The International 2018' :\n",
" match_ids.append(json_data[i].get('match_id'))\n",
" matchups[json_data[i].get('match_id')] = [json_data[i].get('dire_name'), json_data[i].get('radiant_name')]\n",
" elif len(match_ids) > 0 :\n",
" cont = False\n",
" break\n",
" if len(match_ids) == 0 :\n",
" less_than_match = '?less_than_match_id=' + str(json_data[i].get('match_id'))\n",
" else :\n",
" less_than_match = '?less_than_match_id=' + str(match_ids[len(match_ids) - 1])\n",
" with open('match_ids.pickle', 'wb') as outfile: \n",
" pickle.dump(match_ids, outfile)\n",
" with open('matchups.pickle', 'wb') as outfile: \n",
" pickle.dump(matchups, outfile)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next I created a pickled file that consists of an API call that returns a general dataset of all 116 heroes that exist in the game."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"file = Path('hero.pickle')\n",
"if not file.exists() :\n",
" url = 'https://api.opendota.com/api/heroes'\n",
" r = requests.get(url)\n",
" hero_json = r.json()\n",
" with open('hero.pickle', 'wb') as outfile: \n",
" pickle.dump(hero_json, outfile)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Using the 'hero.pickle' file, I created a dictionary where each hero represents a key and their values are an empty NumPy array.\n",
"This array will be used later to keep a running tally of stats for that hero throughout the tournament with each index of the arrray representing a different data point (kills, assists, etc.)."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"with open('hero.pickle', 'rb') as json_file: \n",
" hero_json = pickle.load(json_file)\n",
"\n",
"index = []\n",
"hero_ids = []\n",
"\n",
"for i in range(len(hero_json)) :\n",
" hero = hero_json[i]\n",
" index.append(hero['localized_name'])\n",
" hero_ids.append(hero['id'])\n",
"\n",
"hero_stats = {hero_id: np.zeros(10) for hero_id in hero_ids}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Function *matchParser* takes the JSON data for a single match, accessed via its unique match ID number, and populates the dictionaries that correspond to statistics collected by hero, player, or team."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"def matchParser(json_data, hero_stats, player_stats, player_hero_pool, matchups, team_stats, team_hero_pool) :\n",
" draft_timings_json = json_data['draft_timings']\n",
" players_json = json_data['players']\n",
" for i in range(10) : # for each player/hero in the game\n",
" player = players_json[i]\n",
" hero_id = player['hero_id']\n",
" player_id = player['name']\n",
" side = int(player['isRadiant'])\n",
" match_id = player['match_id']\n",
" team = matchups[match_id][side]\n",
" \n",
" if not team_stats.has_key(team) :\n",
" team_stats[team] = np.zeros(8)\n",
" team_stats[team][3] = 100 # because index 3 is 'fewest deaths' and a default value of 0 will always be the lowest possible\n",
" team_stats[team][7] = 5000 # same reason as above for the 'shortest game' value\n",
" \n",
" curr_hero_stats_array = np.zeros(10) # creates a NumPy array that will serve as a tally of statstics for the current game\n",
" curr_player_stats_array = np.zeros(11) # NumPy array that serves the same purpose as above for stats by player\n",
" if (i == 5 or i == 0) :\n",
" curr_team_stats_array = np.zeros(8)\n",
" curr_team_kills = 0\n",
" curr_team_assists = 0\n",
" curr_team_deaths = 0\n",
"\n",
" curr_hero_stats_array[0] = player.get('win')\n",
" curr_hero_stats_array[1] = 1 # used to keep a count of the number of games that the hero was played during the tournament\n",
" curr_hero_stats_array[3] = player['kills']\n",
" curr_hero_stats_array[4] = player['assists']\n",
" curr_hero_stats_array[7] = player['last_hits']\n",
" curr_hero_stats_array[8] = player['xp_per_min']\n",
" curr_hero_stats_array[9] = player['deaths']\n",
" \n",
" curr_player_stats_array[0] = 1 # also keeps count of the number of games the player has played during TI8\n",
" curr_player_stats_array[1] = player['kills']\n",
" curr_player_stats_array[3] = player['deaths']\n",
" curr_player_stats_array[4] = player['assists']\n",
" curr_player_stats_array[6] = player['last_hits']\n",
" curr_player_stats_array[8] = player['gold_per_min']\n",
" \n",
" curr_team_stats_array[0] = 1\n",
" curr_team_kills += player['kills']\n",
" curr_team_assists += player['assists']\n",
" curr_team_deaths += player['deaths']\n",
" \n",
" hero_stats_array = hero_stats[hero_id]\n",
" hero_stats[hero_id] = np.add(curr_hero_stats_array, hero_stats_array) # adds stats for the current game together with the running total in hero_stats_array\n",
"\n",
" # checks to see if the current number of kills is greater than the hero's maximum kills and switches the max kills value if necessary\n",
" most_kills = hero_stats_array[5] \n",
" curr_kills = curr_hero_stats_array[3]\n",
" if most_kills < curr_kills :\n",
" hero_stats[hero_id][5] = curr_kills\n",
" \n",
" # the logic above is repeated for last hits\n",
" most_last_hits = hero_stats_array[6]\n",
" curr_last_hits = curr_hero_stats_array[7]\n",
" if most_last_hits < curr_last_hits :\n",
" hero_stats[hero_id][6] = curr_last_hits\n",
" \n",
" if not player_stats.has_key(player_id) :\n",
" player_stats[player_id] = np.zeros(11)\n",
" \n",
" player_stats_array = player_stats[player_id]\n",
" player_stats[player_id] = np.add(curr_player_stats_array, player_stats_array)\n",
" \n",
" most_kills = player_stats_array[2]\n",
" curr_kills = curr_player_stats_array[1]\n",
" if most_kills < curr_kills :\n",
" player_stats[player_id][2] = curr_kills\n",
" \n",
" most_assists = player_stats_array[5]\n",
" curr_assists = curr_player_stats_array[4]\n",
" if most_assists < curr_assists :\n",
" player_stats[player_id][5] = curr_assists\n",
" \n",
" most_last_hits = player_stats_array[7]\n",
" curr_last_hits = curr_player_stats_array[6]\n",
" if most_last_hits < curr_last_hits :\n",
" player_stats[player_id][7] = curr_last_hits\n",
" \n",
" highest_gpm = player_stats_array[9]\n",
" curr_gpm = curr_player_stats_array[8]\n",
" if highest_gpm < curr_gpm :\n",
" player_stats[player_id][9] = curr_gpm\n",
" \n",
" if (i == 4 or i == 9) :\n",
" team_stats_array = team_stats[team]\n",
" curr_team_stats_array[2] = curr_team_kills\n",
" team_stats[team] = np.add(curr_team_stats_array, team_stats_array)\n",
"\n",
" most_kills = team_stats_array[1]\n",
" curr_kills = curr_team_kills\n",
" if most_kills < curr_kills :\n",
" team_stats[team][1] = curr_kills\n",
"\n",
" most_assists = team_stats_array[4]\n",
" curr_assists = curr_team_assists\n",
" if most_assists < curr_assists :\n",
" team_stats[team][4] = curr_assists\n",
"\n",
" least_deaths = team_stats_array[3]\n",
" curr_deaths = curr_team_deaths\n",
" if least_deaths > curr_deaths :\n",
" team_stats[team][3] = curr_deaths\n",
" \n",
" if(player['win'] == 1) :\n",
" longest_game = team_stats_array[6]\n",
" shortest_game = team_stats_array[7]\n",
" curr_length = json_data['duration']\n",
" if longest_game < curr_length :\n",
" team_stats[team][6] = curr_length\n",
" if shortest_game > curr_length :\n",
" team_stats[team][7] = curr_length\n",
" \n",
" if not player_hero_pool.has_key(player_id) : # checks if a given player does not already have an entry in player_hero_pool\n",
" player_hero_pool[player_id] = set([]) # if they don't have an entry, an empty set is created for that player\n",
" player_hero_pool[player_id].add(hero_id) # the hero ID of the current hero is added to that player's 'hero pool'\n",
" \n",
" if not team_hero_pool.has_key(team) : # checks if a given team does not already have an entry in team_hero_pool\n",
" team_hero_pool[team] = set([]) # if they don't have an entry, an empty set is created for that team\n",
" team_hero_pool[team].add(hero_id) # the hero ID of the current hero is added to that team's 'hero pool' set\n",
" \n",
" for j in range(22) : # for\n",
" curr_phase = draft_timings_json[j]\n",
" if curr_phase['pick'] == False :\n",
" hero_stats[curr_phase['hero_id']][2] += 1\n",
" return hero_stats, player_stats, player_hero_pool, team_hero_pool, team_stats"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Since the NumPy array tied to each hero in the dictionary only contains a running total of metrics like kills throughout the tournament, *convertHeroStats* translates these total values to averages per game to standardize it against other heroes."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"def convertHeroStats(hero_stats) :\n",
" for hero in hero_stats.keys() :\n",
" number_of_games = hero_stats[hero][1]\n",
" if number_of_games > 0 :\n",
" hero_stats[hero][0] /= number_of_games\n",
" hero_stats[hero][3] /= number_of_games\n",
" hero_stats[hero][4] /= number_of_games\n",
" hero_stats[hero][7] /= number_of_games\n",
" hero_stats[hero][8] /= number_of_games\n",
" hero_stats[hero][9] /= number_of_games\n",
" return hero_stats"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*convertPlayerStats* acts similarly to the function above, just in the context of the player stats dictionary. It also gives the player a value for the number of unique heroes they played by finding the length of their \"hero pool\" set that stores the heroID for every hero they played during the tournament."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"def convertPlayerStats(player_stats, player_hero_pool) :\n",
" for player in player_stats.keys() :\n",
" number_of_games = player_stats[player][0]\n",
" if number_of_games > 0 :\n",
" player_stats[player][1] /= number_of_games\n",
" player_stats[player][3] /= number_of_games\n",
" player_stats[player][4] /= number_of_games\n",
" player_stats[player][6] /= number_of_games\n",
" player_stats[player][8] /= number_of_games\n",
" player_stats[player][10] = len(player_hero_pool[player])\n",
" return player_stats"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As before, *convertTeamStats* works just like the previous two functions, but for the team statistics dictionary."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"def convertTeamStats(team_stats, team_hero_pool) :\n",
" for team in team_stats.keys() :\n",
" number_of_games = team_stats[team][0] \n",
" if number_of_games > 0 :\n",
" team_stats[team][2] /= number_of_games\n",
" team_stats[team][5] = len(team_hero_pool[team])\n",
" return team_stats"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As I mentioned before, I have yet to open the .pickle files created previously. I started by loading the list of the tournament's match_id's into a list, along with loading the matchups dictionary from its file. Then, for each of TI8's 195 games, I made a get request to the API for a specific match ID, saved the response as a JSON, dumped that JSON into a .pickle for future access, and finally passed the JSON onto the *matchParser* function to populate the three main data dictionaries."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"player_stats = {}\n",
"player_hero_pool = {}\n",
"team_hero_pool = {}\n",
"team_stats = {}\n",
"with open('match_ids.pickle', 'rb') as json_file: \n",
" match_ids = pickle.load(json_file)\n",
"with open('matchups.pickle', 'rb') as json_file: \n",
" matchups = pickle.load(json_file)\n",
"for j in range(len(match_ids)) :\n",
" path = str(match_ids[j]) + '.pickle'\n",
" file = Path(path)\n",
" if not file.exists() :\n",
" url = 'https://api.opendota.com/api/matches/' + str(match_ids[j])\n",
" r = requests.get(url)\n",
" json_data = r.json()\n",
" with open(path, 'wb') as outfile: \n",
" pickle.dump(json_data, outfile)\n",
" else :\n",
" with open(path, 'rb') as data:\n",
" json_data = pickle.load(data)\n",
" hero_stats, player_stats, player_hero_pool, team_hero_pool, team_stats = matchParser(json_data, hero_stats, player_stats, player_hero_pool, matchups, team_stats, team_hero_pool)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Once all the games have been parsed, I have three dictionaries that can each be converted into pandas DataFrames to represent the data in a more visually appealing manner. I converted the heroes directory to a DataFrame and defined the DataFrame's index and columns to increase clarity (instead of displaying heroes by their ID)."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Winrate</th>\n",
" <th>Games Picked</th>\n",
" <th>Games Banned</th>\n",
" <th>Kill Average</th>\n",
" <th>Assist Average</th>\n",
" <th>Most Kills</th>\n",
" <th>Most Last Hits</th>\n",
" <th>Average Last Hits</th>\n",
" <th>Average XPM</th>\n",
" <th>Death Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Anti-Mage</th>\n",
" <td>0.000000</td>\n",
" <td>1.0</td>\n",
" <td>2.0</td>\n",
" <td>4.000000</td>\n",
" <td>4.000000</td>\n",
" <td>4.0</td>\n",
" <td>331.0</td>\n",
" <td>331.000000</td>\n",
" <td>681.000000</td>\n",
" <td>5.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Axe</th>\n",
" <td>0.666667</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
" <td>13.000000</td>\n",
" <td>9.333333</td>\n",
" <td>18.0</td>\n",
" <td>298.0</td>\n",
" <td>211.666667</td>\n",
" <td>519.333333</td>\n",
" <td>4.333333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Bane</th>\n",
" <td>0.555556</td>\n",
" <td>36.0</td>\n",
" <td>19.0</td>\n",
" <td>2.805556</td>\n",
" <td>13.722222</td>\n",
" <td>8.0</td>\n",
" <td>107.0</td>\n",
" <td>29.305556</td>\n",
" <td>348.777778</td>\n",
" <td>7.805556</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Bloodseeker</th>\n",
" <td>0.483871</td>\n",
" <td>31.0</td>\n",
" <td>47.0</td>\n",
" <td>8.774194</td>\n",
" <td>11.806452</td>\n",
" <td>22.0</td>\n",
" <td>561.0</td>\n",
" <td>268.096774</td>\n",
" <td>535.387097</td>\n",
" <td>5.290323</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Crystal Maiden</th>\n",
" <td>0.500000</td>\n",
" <td>52.0</td>\n",
" <td>40.0</td>\n",
" <td>2.384615</td>\n",
" <td>13.038462</td>\n",
" <td>9.0</td>\n",
" <td>171.0</td>\n",
" <td>61.250000</td>\n",
" <td>359.307692</td>\n",
" <td>7.288462</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Winrate Games Picked Games Banned Kill Average \\\n",
"Anti-Mage 0.000000 1.0 2.0 4.000000 \n",
"Axe 0.666667 3.0 3.0 13.000000 \n",
"Bane 0.555556 36.0 19.0 2.805556 \n",
"Bloodseeker 0.483871 31.0 47.0 8.774194 \n",
"Crystal Maiden 0.500000 52.0 40.0 2.384615 \n",
"\n",
" Assist Average Most Kills Most Last Hits Average Last Hits \\\n",
"Anti-Mage 4.000000 4.0 331.0 331.000000 \n",
"Axe 9.333333 18.0 298.0 211.666667 \n",
"Bane 13.722222 8.0 107.0 29.305556 \n",
"Bloodseeker 11.806452 22.0 561.0 268.096774 \n",
"Crystal Maiden 13.038462 9.0 171.0 61.250000 \n",
"\n",
" Average XPM Death Average \n",
"Anti-Mage 681.000000 5.000000 \n",
"Axe 519.333333 4.333333 \n",
"Bane 348.777778 7.805556 \n",
"Bloodseeker 535.387097 5.290323 \n",
"Crystal Maiden 359.307692 7.288462 "
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"columns = ['Winrate', 'Games Picked', 'Games Banned', 'Kill Average',\n",
" 'Assist Average', 'Most Kills', 'Most Last Hits',\n",
" 'Average Last Hits', 'Average XPM', 'Death Average']\n",
"hero_stats = convertHeroStats(hero_stats)\n",
"heroes = pd.DataFrame.from_dict(hero_stats, orient='index', columns=columns)\n",
"heroes.index = index\n",
"heroes.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For creating the player statistics DataFrame I followed the same procedure as above, although the index did not need to be defined because the keys of the dictionary were already player names."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Games Played</th>\n",
" <th>Kill Average</th>\n",
" <th>Most Kills</th>\n",
" <th>Death Average</th>\n",
" <th>Assist Average</th>\n",
" <th>Most Assists</th>\n",
" <th>Last Hit Average</th>\n",
" <th>Most Last Hits</th>\n",
" <th>GPM Average</th>\n",
" <th>Highest GPM</th>\n",
" <th>Heroes Played</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>raining</th>\n",
" <td>18.0</td>\n",
" <td>4.333333</td>\n",
" <td>13.0</td>\n",
" <td>5.611111</td>\n",
" <td>10.166667</td>\n",
" <td>24.0</td>\n",
" <td>181.055556</td>\n",
" <td>356.0</td>\n",
" <td>384.611111</td>\n",
" <td>587.0</td>\n",
" <td>13.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>EternaLEnVy</th>\n",
" <td>17.0</td>\n",
" <td>4.705882</td>\n",
" <td>17.0</td>\n",
" <td>5.588235</td>\n",
" <td>8.294118</td>\n",
" <td>16.0</td>\n",
" <td>295.352941</td>\n",
" <td>588.0</td>\n",
" <td>476.235294</td>\n",
" <td>594.0</td>\n",
" <td>11.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>RAMZES666</th>\n",
" <td>25.0</td>\n",
" <td>9.520000</td>\n",
" <td>15.0</td>\n",
" <td>4.080000</td>\n",
" <td>11.280000</td>\n",
" <td>29.0</td>\n",
" <td>279.920000</td>\n",
" <td>538.0</td>\n",
" <td>558.440000</td>\n",
" <td>741.0</td>\n",
" <td>13.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>xNova</th>\n",
" <td>30.0</td>\n",
" <td>2.866667</td>\n",
" <td>9.0</td>\n",
" <td>7.066667</td>\n",
" <td>14.700000</td>\n",
" <td>28.0</td>\n",
" <td>54.266667</td>\n",
" <td>113.0</td>\n",
" <td>285.266667</td>\n",
" <td>412.0</td>\n",
" <td>13.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>YapzOr</th>\n",
" <td>26.0</td>\n",
" <td>4.615385</td>\n",
" <td>11.0</td>\n",
" <td>4.692308</td>\n",
" <td>16.461538</td>\n",
" <td>32.0</td>\n",
" <td>80.115385</td>\n",
" <td>224.0</td>\n",
" <td>306.961538</td>\n",
" <td>437.0</td>\n",
" <td>11.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Games Played Kill Average Most Kills Death Average \\\n",
"raining 18.0 4.333333 13.0 5.611111 \n",
"EternaLEnVy 17.0 4.705882 17.0 5.588235 \n",
"RAMZES666 25.0 9.520000 15.0 4.080000 \n",
"xNova 30.0 2.866667 9.0 7.066667 \n",
"YapzOr 26.0 4.615385 11.0 4.692308 \n",
"\n",
" Assist Average Most Assists Last Hit Average Most Last Hits \\\n",
"raining 10.166667 24.0 181.055556 356.0 \n",
"EternaLEnVy 8.294118 16.0 295.352941 588.0 \n",
"RAMZES666 11.280000 29.0 279.920000 538.0 \n",
"xNova 14.700000 28.0 54.266667 113.0 \n",
"YapzOr 16.461538 32.0 80.115385 224.0 \n",
"\n",
" GPM Average Highest GPM Heroes Played \n",
"raining 384.611111 587.0 13.0 \n",
"EternaLEnVy 476.235294 594.0 11.0 \n",
"RAMZES666 558.440000 741.0 13.0 \n",
"xNova 285.266667 412.0 13.0 \n",
"YapzOr 306.961538 437.0 11.0 "
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"columns2 = ['Games Played', 'Kill Average', 'Most Kills', 'Death Average',\n",
" 'Assist Average', 'Most Assists', 'Last Hit Average',\n",
" 'Most Last Hits', 'GPM Average', 'Highest GPM', 'Heroes Played']\n",
"player_stats = convertPlayerStats(player_stats, player_hero_pool)\n",
"players = pd.DataFrame.from_dict(player_stats, orient='index', columns=columns2)\n",
"players.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Last I created the DataFrame for team statistics as I did twice before. This process included a couple more manipulations because the *Longest Game* and *Shortest Game* statistics were referenced in number of seconds because all indexes of a NumPy array are required to have the same data type (in this case float). I removed those columns from the DataFrame once it was created and then converted them to a timedelta64 datatype and added them back to the DataFrame. There was also a weird issue where *Optic Gaming* was being referenced as an empty string from the API, so I manually changed it."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Games Played</th>\n",
" <th>Most Kills</th>\n",
" <th>Kill Average</th>\n",
" <th>Fewest Deaths</th>\n",
" <th>Most Assists</th>\n",
" <th>Heroes Played</th>\n",
" <th>Longest Game</th>\n",
" <th>Shortest Game</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Optic Gaming</th>\n",
" <td>24.0</td>\n",
" <td>51.0</td>\n",
" <td>25.083333</td>\n",
" <td>9.0</td>\n",
" <td>117.0</td>\n",
" <td>52.0</td>\n",
" <td>[0:47:28]</td>\n",
" <td>[0:29:06]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Newbee</th>\n",
" <td>19.0</td>\n",
" <td>48.0</td>\n",
" <td>28.789474</td>\n",
" <td>13.0</td>\n",
" <td>116.0</td>\n",
" <td>39.0</td>\n",
" <td>[1:19:08]</td>\n",
" <td>[0:32:10]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Team Secret</th>\n",
" <td>26.0</td>\n",
" <td>47.0</td>\n",
" <td>28.846154</td>\n",
" <td>2.0</td>\n",
" <td>107.0</td>\n",
" <td>58.0</td>\n",
" <td>[0:55:20]</td>\n",
" <td>[0:18:24]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Virtus.pro</th>\n",
" <td>25.0</td>\n",
" <td>60.0</td>\n",
" <td>31.160000</td>\n",
" <td>10.0</td>\n",
" <td>115.0</td>\n",
" <td>46.0</td>\n",
" <td>[0:53:47]</td>\n",
" <td>[0:22:35]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OG</th>\n",
" <td>29.0</td>\n",
" <td>52.0</td>\n",
" <td>30.000000</td>\n",
" <td>6.0</td>\n",
" <td>120.0</td>\n",
" <td>47.0</td>\n",
" <td>[1:05:21]</td>\n",
" <td>[0:16:59]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Games Played Most Kills Kill Average Fewest Deaths \\\n",
"Optic Gaming 24.0 51.0 25.083333 9.0 \n",
"Newbee 19.0 48.0 28.789474 13.0 \n",
"Team Secret 26.0 47.0 28.846154 2.0 \n",
"Virtus.pro 25.0 60.0 31.160000 10.0 \n",
"OG 29.0 52.0 30.000000 6.0 \n",
"\n",
" Most Assists Heroes Played Longest Game Shortest Game \n",
"Optic Gaming 117.0 52.0 [0:47:28] [0:29:06] \n",
"Newbee 116.0 39.0 [1:19:08] [0:32:10] \n",
"Team Secret 107.0 58.0 [0:55:20] [0:18:24] \n",
"Virtus.pro 115.0 46.0 [0:53:47] [0:22:35] \n",
"OG 120.0 47.0 [1:05:21] [0:16:59] "
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"columns3 = ['Games Played', 'Most Kills', 'Kill Average', 'Fewest Deaths', 'Most Assists', \n",
" 'Heroes Played', 'Longest Game', 'Shortest Game']\n",
"team_stats = convertTeamStats(team_stats, team_hero_pool)\n",
"teams = pd.DataFrame.from_dict(team_stats, orient='index', columns=columns3)\n",
"longest_game = teams.iloc[:, 6:7].values # because NumPy arrays must contain all the same value types, the last two columns are removed\n",
"shortest_game = teams.iloc[:, 7:8].values #\n",
"teams = teams.iloc[:, 0:6]\n",
"longest_game_time = longest_game.astype('timedelta64[s]').tolist()\n",
"shortest_game_time = shortest_game.astype('timedelta64[s]').tolist()\n",
"teams['Longest Game'] = longest_game_time\n",
"teams['Shortest Game'] = shortest_game_time\n",
"index = teams.index.values\n",
"index[0] = 'Optic Gaming'\n",
"teams.index = index\n",
"teams.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Analyzing Predictions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now that DataFrames have been created for all the heroes, players, and teams at TI8, we can now look at the results of various predictions post-tournament. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### General tournament predictions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Total number of heroes picked: 110"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(110, 10)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes_picked = heroes[heroes['Games Picked'] > 0]\n",
"heroes_picked.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Total number of heroes banned: 96"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(96, 10)"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes_banned = heroes[heroes['Games Banned'] > 0]\n",
"heroes_banned.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Predictions related to specific heroes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First is the most picked hero at the tournament: Vengeful Spirit"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Games Picked</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Vengeful Spirit</th>\n",
" <td>89.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Tiny</th>\n",
" <td>78.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Mirana</th>\n",
" <td>74.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Wraith King</th>\n",
" <td>66.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Dark Willow</th>\n",
" <td>66.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Games Picked\n",
"Vengeful Spirit 89.0\n",
"Tiny 78.0\n",
"Mirana 74.0\n",
"Wraith King 66.0\n",
"Dark Willow 66.0"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Games Picked', ascending=False, inplace=True)\n",
"heroes.iloc[:,1:2].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Next I found the most banned hero: Enchantress"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Games Banned</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Enchantress</th>\n",
" <td>150.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Io</th>\n",
" <td>140.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Weaver</th>\n",
" <td>117.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Necrophos</th>\n",
" <td>114.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Silencer</th>\n",
" <td>107.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Games Banned\n",
"Enchantress 150.0\n",
"Io 140.0\n",
"Weaver 117.0\n",
"Necrophos 114.0\n",
"Silencer 107.0"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Games Banned', ascending=False, inplace=True)\n",
"heroes.iloc[:,2:3].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hero with the most kills in a game: Tiny"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Most Kills</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Tiny</th>\n",
" <td>31.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Clinkz</th>\n",
" <td>24.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Bloodseeker</th>\n",
" <td>22.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Invoker</th>\n",
" <td>22.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Weaver</th>\n",
" <td>21.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Most Kills\n",
"Tiny 31.0\n",
"Clinkz 24.0\n",
"Bloodseeker 22.0\n",
"Invoker 22.0\n",
"Weaver 21.0"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Most Kills', ascending=False, inplace=True)\n",
"heroes.iloc[:,5:6].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hero with the most last hits in a game: Tinker"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Most Last Hits</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Tinker</th>\n",
" <td>864.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Timbersaw</th>\n",
" <td>758.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Terrorblade</th>\n",
" <td>731.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Arc Warden</th>\n",
" <td>686.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Lina</th>\n",
" <td>672.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Most Last Hits\n",
"Tinker 864.0\n",
"Timbersaw 758.0\n",
"Terrorblade 731.0\n",
"Arc Warden 686.0\n",
"Lina 672.0"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Most Last Hits', ascending=False, inplace=True)\n",
"heroes.iloc[:,6:7].head()"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"For the rest of the predictions, there is a stipulation that all the heroes surveyed must have a minimum of five games played.\n",
"In order to more easily process this I created a DataFrame 'heroes_5' that only includes heroes with 5 or more games played."
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"heroes = heroes[heroes['Games Picked'] >= 5]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hero with the highest winrate: Venomancer"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Winrate</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Venomancer</th>\n",
" <td>0.692308</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Drow Ranger</th>\n",
" <td>0.689655</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Arc Warden</th>\n",
" <td>0.666667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Invoker</th>\n",
" <td>0.666667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Broodmother</th>\n",
" <td>0.666667</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Winrate\n",
"Venomancer 0.692308\n",
"Drow Ranger 0.689655\n",
"Arc Warden 0.666667\n",
"Invoker 0.666667\n",
"Broodmother 0.666667"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Winrate', ascending=False, inplace=True)\n",
"heroes.iloc[:,0:1].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hero with the highest kill average: Timbersaw"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Kill Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Timbersaw</th>\n",
" <td>10.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Gyrocopter</th>\n",
" <td>9.588235</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Invoker</th>\n",
" <td>9.458333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Broodmother</th>\n",
" <td>9.388889</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Clinkz</th>\n",
" <td>9.254902</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Kill Average\n",
"Timbersaw 10.000000\n",
"Gyrocopter 9.588235\n",
"Invoker 9.458333\n",
"Broodmother 9.388889\n",
"Clinkz 9.254902"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Kill Average', ascending=False, inplace=True)\n",
"heroes.iloc[:,3:4].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hero with the highest assist average: Tusk"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Assist Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Tusk</th>\n",
" <td>17.466667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Nyx Assassin</th>\n",
" <td>17.050000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Vengeful Spirit</th>\n",
" <td>16.988764</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Phoenix</th>\n",
" <td>16.821429</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Earth Spirit</th>\n",
" <td>16.700000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Assist Average\n",
"Tusk 17.466667\n",
"Nyx Assassin 17.050000\n",
"Vengeful Spirit 16.988764\n",
"Phoenix 16.821429\n",
"Earth Spirit 16.700000"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Assist Average', ascending=False, inplace=True)\n",
"heroes.iloc[:,4:5].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hero with the lowest death average: Medusa"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Death Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Medusa</th>\n",
" <td>2.666667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Broodmother</th>\n",
" <td>3.166667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Lycan</th>\n",
" <td>3.250000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Faceless Void</th>\n",
" <td>3.375000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Templar Assassin</th>\n",
" <td>3.615385</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Death Average\n",
"Medusa 2.666667\n",
"Broodmother 3.166667\n",
"Lycan 3.250000\n",
"Faceless Void 3.375000\n",
"Templar Assassin 3.615385"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Death Average', inplace=True)\n",
"heroes.iloc[:,9:10].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hero with the highest last hit average: Shadow Fiend"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Average Last Hits</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Shadow Fiend</th>\n",
" <td>475.833333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Terrorblade</th>\n",
" <td>437.352941</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Medusa</th>\n",
" <td>427.833333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Alchemist</th>\n",
" <td>397.500000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Timbersaw</th>\n",
" <td>394.800000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Average Last Hits\n",
"Shadow Fiend 475.833333\n",
"Terrorblade 437.352941\n",
"Medusa 427.833333\n",
"Alchemist 397.500000\n",
"Timbersaw 394.800000"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Average Last Hits', ascending=False, inplace=True)\n",
"heroes.iloc[:,7:8].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hero with the highest XPM average: Timbersaw"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Average XPM</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Timbersaw</th>\n",
" <td>690.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Medusa</th>\n",
" <td>676.833333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Broodmother</th>\n",
" <td>668.055556</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Weaver</th>\n",
" <td>641.548387</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Templar Assassin</th>\n",
" <td>637.923077</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Average XPM\n",
"Timbersaw 690.000000\n",
"Medusa 676.833333\n",
"Broodmother 668.055556\n",
"Weaver 641.548387\n",
"Templar Assassin 637.923077"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"heroes.sort_values(by='Average XPM', ascending=False, inplace=True)\n",
"heroes.iloc[:,8:9].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Predictions related to specific players"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the highest kill average: Miracle-"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Kill Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Miracle-</th>\n",
" <td>11.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SumaiL</th>\n",
" <td>10.222222</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Somnus丶M</th>\n",
" <td>9.833333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>rtz</th>\n",
" <td>9.629630</td>\n",
" </tr>\n",
" <tr>\n",
" <th>RAMZES666</th>\n",
" <td>9.520000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Kill Average\n",
"Miracle- 11.000000\n",
"SumaiL 10.222222\n",
"Somnus丶M 9.833333\n",
"rtz 9.629630\n",
"RAMZES666 9.520000"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Kill Average', ascending=False, inplace=True)\n",
"players.iloc[:,1:2].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the most kills in a game: SumaiL"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Most Kills</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>SumaiL</th>\n",
" <td>31.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Miracle-</th>\n",
" <td>24.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Somnus丶M</th>\n",
" <td>22.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Sccc</th>\n",
" <td>22.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ame</th>\n",
" <td>21.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Most Kills\n",
"SumaiL 31.0\n",
"Miracle- 24.0\n",
"Somnus丶M 22.0\n",
"Sccc 22.0\n",
"Ame 21.0"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Most Kills', ascending=False, inplace=True)\n",
"players.iloc[:,2:3].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the highest assist average: Cr1t-"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Assist Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Cr1t-</th>\n",
" <td>19.111111</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Gh</th>\n",
" <td>18.666667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Solo</th>\n",
" <td>18.640000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Fly</th>\n",
" <td>18.222222</td>\n",
" </tr>\n",
" <tr>\n",
" <th>fy</th>\n",
" <td>17.533333</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Assist Average\n",
"Cr1t- 19.111111\n",
"Gh 18.666667\n",
"Solo 18.640000\n",
"Fly 18.222222\n",
"fy 17.533333"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Assist Average', ascending=False, inplace=True)\n",
"players.iloc[:,4:5].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the lowest death average: Resolut1on"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Death Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Resolut1on</th>\n",
" <td>3.045455</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Raven</th>\n",
" <td>3.117647</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Paparazi灬</th>\n",
" <td>3.150000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9pasha</th>\n",
" <td>3.360000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>No[o]ne-</th>\n",
" <td>3.440000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Death Average\n",
"Resolut1on 3.045455\n",
"Raven 3.117647\n",
"Paparazi灬 3.150000\n",
"9pasha 3.360000\n",
"No[o]ne- 3.440000"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Death Average', inplace=True)\n",
"players.iloc[:,3:4].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the most assists in a game: fy"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Most Assists</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>fy</th>\n",
" <td>35.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Solo</th>\n",
" <td>34.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Cr1t-</th>\n",
" <td>34.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>JerAx</th>\n",
" <td>34.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Fly</th>\n",
" <td>33.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Most Assists\n",
"fy 35.0\n",
"Solo 34.0\n",
"Cr1t- 34.0\n",
"JerAx 34.0\n",
"Fly 33.0"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Most Assists', ascending=False, inplace=True)\n",
"players.iloc[:,5:6].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the highest last hit average: Moonn"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Last Hit Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Moonn</th>\n",
" <td>341.052632</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Sccc</th>\n",
" <td>340.736842</td>\n",
" </tr>\n",
" <tr>\n",
" <th>hFn k3 ♥ M</th>\n",
" <td>338.125000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Resolut1on</th>\n",
" <td>336.681818</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Raven</th>\n",
" <td>334.647059</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Last Hit Average\n",
"Moonn 341.052632\n",
"Sccc 340.736842\n",
"hFn k3 ♥ M 338.125000\n",
"Resolut1on 336.681818\n",
"Raven 334.647059"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Last Hit Average', ascending=False, inplace=True)\n",
"players.iloc[:,6:7].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the most last hits in a game: Moonn"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Most Last Hits</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Moonn</th>\n",
" <td>864.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Raven</th>\n",
" <td>758.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>hFn k3 ♥ M</th>\n",
" <td>731.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ame</th>\n",
" <td>706.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Topson</th>\n",
" <td>686.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Most Last Hits\n",
"Moonn 864.0\n",
"Raven 758.0\n",
"hFn k3 ♥ M 731.0\n",
"Ame 706.0\n",
"Topson 686.0"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Most Last Hits', ascending=False, inplace=True)\n",
"players.iloc[:,7:8].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the highest GPM in a game: Xxs"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Highest GPM</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Xxs</th>\n",
" <td>1109.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>CCnC</th>\n",
" <td>1072.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>XinQ</th>\n",
" <td>1025.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SumaiL</th>\n",
" <td>990.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Miracle-</th>\n",
" <td>980.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Highest GPM\n",
"Xxs 1109.0\n",
"CCnC 1072.0\n",
"XinQ 1025.0\n",
"SumaiL 990.0\n",
"Miracle- 980.0"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Highest GPM', ascending=False, inplace=True)\n",
"players.iloc[:,9:10].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the highest GPM average: Miracle-"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>GPM Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Miracle-</th>\n",
" <td>625.916667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>SumaiL</th>\n",
" <td>619.444444</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ame</th>\n",
" <td>605.533333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Somnus丶M</th>\n",
" <td>605.033333</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Resolut1on</th>\n",
" <td>600.181818</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" GPM Average\n",
"Miracle- 625.916667\n",
"SumaiL 619.444444\n",
"Ame 605.533333\n",
"Somnus丶M 605.033333\n",
"Resolut1on 600.181818"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='GPM Average', ascending=False, inplace=True)\n",
"players.iloc[:,8:9].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Player with the largest hero pool: MidOne"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Heroes Played</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>MidOne</th>\n",
" <td>19.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Miracle-</th>\n",
" <td>17.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Fata</th>\n",
" <td>17.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Ceb</th>\n",
" <td>17.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Pajkatt</th>\n",
" <td>16.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Heroes Played\n",
"MidOne 19.0\n",
"Miracle- 17.0\n",
"Fata 17.0\n",
"Ceb 17.0\n",
"Pajkatt 16.0"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players.sort_values(by='Heroes Played', ascending=False, inplace=True)\n",
"players.iloc[:,10:11].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Predictions related to specific teams"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Team with the most kills in a game: Virtus Pro & Team Liquid (tied)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Most Kills</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Virtus.pro</th>\n",
" <td>60.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Team Liquid</th>\n",
" <td>60.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PSG.LGD</th>\n",
" <td>58.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Evil Geniuses</th>\n",
" <td>53.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OG</th>\n",
" <td>52.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Most Kills\n",
"Virtus.pro 60.0\n",
"Team Liquid 60.0\n",
"PSG.LGD 58.0\n",
"Evil Geniuses 53.0\n",
"OG 52.0"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.sort_values(by='Most Kills', ascending=False, inplace=True)\n",
"teams.iloc[:,1:2].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Team with the higest kill average: Evil Geniuses"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Kill Average</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Evil Geniuses</th>\n",
" <td>34.518519</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PSG.LGD</th>\n",
" <td>33.766667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Team Liquid</th>\n",
" <td>32.500000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Virtus.pro</th>\n",
" <td>31.160000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OG</th>\n",
" <td>30.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Kill Average\n",
"Evil Geniuses 34.518519\n",
"PSG.LGD 33.766667\n",
"Team Liquid 32.500000\n",
"Virtus.pro 31.160000\n",
"OG 30.000000"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.sort_values(by='Kill Average', ascending=False, inplace=True)\n",
"teams.iloc[:,2:3].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Team with the fewest deaths in a game: Fnatic"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Fewest Deaths</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Fnatic</th>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Team Secret</th>\n",
" <td>2.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OG</th>\n",
" <td>6.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Team Serenity</th>\n",
" <td>6.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PSG.LGD</th>\n",
" <td>7.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Fewest Deaths\n",
"Fnatic 1.0\n",
"Team Secret 2.0\n",
"OG 6.0\n",
"Team Serenity 6.0\n",
"PSG.LGD 7.0"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.sort_values(by='Fewest Deaths', inplace=True)\n",
"teams.iloc[:,3:4].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Team with the most assists in a game: PSG.LGD"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Most Assists</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>PSG.LGD</th>\n",
" <td>128.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>INVICTUS GAMING</th>\n",
" <td>125.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Mineski</th>\n",
" <td>121.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OG</th>\n",
" <td>120.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Optic Gaming</th>\n",
" <td>117.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Most Assists\n",
"PSG.LGD 128.0\n",
"INVICTUS GAMING 125.0\n",
"Mineski 121.0\n",
"OG 120.0\n",
"Optic Gaming 117.0"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.sort_values(by='Most Assists', ascending=False, inplace=True)\n",
"teams.iloc[:,4:5].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Team that won the longest game: Mineski"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Longest Game</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Mineski</th>\n",
" <td>[1:21:52]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Newbee</th>\n",
" <td>[1:19:08]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>TNC Predator</th>\n",
" <td>[1:07:42]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OG</th>\n",
" <td>[1:05:21]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Evil Geniuses</th>\n",
" <td>[1:04:17]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Longest Game\n",
"Mineski [1:21:52]\n",
"Newbee [1:19:08]\n",
"TNC Predator [1:07:42]\n",
"OG [1:05:21]\n",
"Evil Geniuses [1:04:17]"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.sort_values(by='Longest Game', ascending=False, inplace=True)\n",
"teams.iloc[:,6:7].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Team that won the shortest game: OG"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Shortest Game</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>OG</th>\n",
" <td>[0:16:59]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Team Secret</th>\n",
" <td>[0:18:24]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Vici Gaming</th>\n",
" <td>[0:18:59]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VGJ Storm</th>\n",
" <td>[0:20:54]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Virtus.pro</th>\n",
" <td>[0:22:35]</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Shortest Game\n",
"OG [0:16:59]\n",
"Team Secret [0:18:24]\n",
"Vici Gaming [0:18:59]\n",
"VGJ Storm [0:20:54]\n",
"Virtus.pro [0:22:35]"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.sort_values(by='Shortest Game', inplace=True)\n",
"teams.iloc[:,7:8].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Team that picked the most different heroes: Team Secret"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Heroes Played</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Team Secret</th>\n",
" <td>58.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>PSG.LGD</th>\n",
" <td>53.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Optic Gaming</th>\n",
" <td>52.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Team Liquid</th>\n",
" <td>48.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>OG</th>\n",
" <td>47.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Heroes Played\n",
"Team Secret 58.0\n",
"PSG.LGD 53.0\n",
"Optic Gaming 52.0\n",
"Team Liquid 48.0\n",
"OG 47.0"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.sort_values(by='Heroes Played', ascending=False, inplace=True)\n",
"teams.iloc[:,5:6].head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Team that picked the least different heroes: TNC Predator"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Heroes Played</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>TNC Predator</th>\n",
" <td>34.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Team Serenity</th>\n",
" <td>35.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>VGJ Thunder</th>\n",
" <td>37.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Vici Gaming</th>\n",
" <td>38.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Newbee</th>\n",
" <td>39.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Heroes Played\n",
"TNC Predator 34.0\n",
"Team Serenity 35.0\n",
"VGJ Thunder 37.0\n",
"Vici Gaming 38.0\n",
"Newbee 39.0"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"teams.sort_values(by='Heroes Played', inplace=True)\n",
"teams.iloc[:,5:6].head()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.15"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment