Matchup and Cohort Analysis
[1]:
from pyETT import ett
The ett Class Cohort manages state, logic and analytics for a cohort of players (instances of the Class Player). Let’s take a look at how the top ETT players in the world match up against each other. First, we create a cohort with the top 10 players from the leaderboard:
[2]:
lb_cohort = ett.Cohort(ett.ETT().get_leaderboard(num_players=10))
lb_cohort.size
[2]:
10
[3]:
lb_cohort.players_dataframe()
[3]:
id | name | elo | rank | wins | losses | last_online | |
---|---|---|---|---|---|---|---|
0 | 315909 | Aiphaton | 3204.0 | 1 | 550 | 70 | 2021-08-26T18:33:35.943Z |
1 | 347650 | PROTT_VR | 3134.0 | 2 | 715 | 142 | 2021-08-28T16:14:23.328Z |
2 | 484532 | Seldon36 | 3114.3 | 3 | 699 | 241 | 2021-08-30T15:48:03.137Z |
3 | 20585 | fmwallin | 3072.0 | 4 | 1669 | 971 | 2021-08-30T12:41:21.933Z |
4 | 234850 | Lapoctopus | 3069.1 | 5 | 759 | 268 | 2021-08-20T18:36:38.299Z |
5 | 4410 | wurstfriedl | 3028.0 | 6 | 2364 | 954 | 2021-08-27T12:16:32.301Z |
6 | 372961 | sunking73 | 2995.5 | 7 | 599 | 251 | 2021-06-20T11:44:49.214Z |
7 | 385684 | yedat | 2994.2 | 10 | 1037 | 297 | 2021-08-07T05:47:36.647Z |
8 | 11002 | twISTer1979 | 2960.6 | 9 | 2542 | 972 | 2021-08-28T16:53:27.962Z |
9 | 3831 | alexttbcn | 2958.0 | 12 | 1327 | 625 | 2021-08-26T14:10:40.840Z |
By accessing the attribute size
and calling the methods players_dataframe()
from the Cohort object, we obtain the cohort size (10) and the list of players in the cohort. We can get the Elo history of the players in the cohort with the method get_elo_history()
:
[4]:
lb_cohort_elo = lb_cohort.get_elo_history()
lb_cohort_elo
[4]:
Aiphaton | PROTT_VR | Seldon36 | fmwallin | Lapoctopus | wurstfriedl | sunking73 | yedat | twISTer1979 | alexttbcn | |
---|---|---|---|---|---|---|---|---|---|---|
2020-02-29T13:03:53.451Z | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 1500.0 |
2020-02-29T13:09:19.941Z | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 1527.0 |
2020-02-29T13:18:01.313Z | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 1521.0 |
2020-02-29T13:20:46.824Z | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 1536.0 |
2020-02-29T13:27:06.816Z | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 1550.0 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2021-08-30T12:11:47.612Z | 3200.0 | 3138.0 | 3114.3 | 3072.0 | 3074.1 | 3028.0 | 3001.5 | 2995.2 | 2954.6 | 2955.0 |
2021-08-30T12:16:45.042Z | 3200.0 | 3138.0 | 3117.3 | 3069.0 | 3074.1 | 3028.0 | 3001.5 | 2995.2 | 2954.6 | 2955.0 |
2021-08-30T12:23:36.680Z | 3200.0 | 3138.0 | 3113.3 | 3073.0 | 3074.1 | 3028.0 | 3001.5 | 2995.2 | 2954.6 | 2955.0 |
2021-08-30T12:30:05.759Z | 3200.0 | 3138.0 | 3110.3 | 3076.0 | 3074.1 | 3028.0 | 3001.5 | 2995.2 | 2954.6 | 2955.0 |
2021-08-30T12:37:25.487Z | 3200.0 | 3138.0 | 3112.3 | 3074.0 | 3074.1 | 3028.0 | 3001.5 | 2995.2 | 2954.6 | 2955.0 |
14358 rows × 10 columns
[5]:
lb_cohort_elo.plot(figsize=(10,8))
[5]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f27d2d5b640>
We can obtain the full list of matches played within the cohort, i.e., match ups, by accessing the method get_matches()
or get_matches_dataframe()
to obtain results in a pandas DataFrame:
[6]:
lb_cohort.get_matches_dataframe()
[6]:
created_at | id | ranked | number_of_rounds | state | winning_team | losing_team | home_score | away_score | elo_change | home_elo_avg | away_elo_avg | home_player | away_player | rounds | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2021-07-25T15:03:46.195Z | 10674157 | True | 3 | 1 | 1 | 0 | 0 | 0 | 19.0 | 3107.0 | 3038.0 | PROTT_VR | Aiphaton | [<pyETT.ett.Match.Round object at 0x7f27d00c09... |
1 | 2021-07-25T15:11:19.296Z | 10674382 | True | 3 | 1 | 1 | 0 | 0 | 0 | 9.0 | 3088.0 | 3057.0 | PROTT_VR | Aiphaton | [<pyETT.ett.Match.Round object at 0x7f27d00c0b... |
2 | 2021-07-25T15:17:52.938Z | 10674591 | True | 3 | 1 | 1 | 0 | 0 | 0 | 5.0 | 3079.0 | 3066.0 | PROTT_VR | Aiphaton | [<pyETT.ett.Match.Round object at 0x7f27d00d97... |
3 | 2021-07-25T15:25:15.522Z | 10674804 | True | 3 | 1 | 1 | 0 | 0 | 0 | 2.0 | 3074.0 | 3071.0 | PROTT_VR | Aiphaton | [<pyETT.ett.Match.Round object at 0x7f27d00d9f... |
4 | 2021-08-25T18:06:09.908Z | 11753227 | True | 3 | 1 | 1 | 0 | 0 | 0 | 13.0 | 3138.0 | 3200.0 | PROTT_VR | Aiphaton | [<pyETT.ett.Match.Round object at 0x7f27d00d14... |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
911 | 2021-01-22T13:49:59.089Z | 3694516 | True | 3 | 1 | 0 | 1 | 0 | 0 | 11.0 | 2816.0 | 2883.0 | twISTer1979 | alexttbcn | [<pyETT.ett.Match.Round object at 0x7f27ca6aa6... |
912 | 2021-02-20T18:38:54.237Z | 4832703 | True | 3 | 1 | 0 | 1 | 0 | 0 | 15.0 | 2905.0 | 2943.0 | twISTer1979 | alexttbcn | [<pyETT.ett.Match.Round object at 0x7f27ca6aa6... |
913 | 2021-02-20T18:45:13.317Z | 4832978 | True | 3 | 1 | 1 | 0 | 0 | 0 | 8.0 | 2920.0 | 2928.0 | twISTer1979 | alexttbcn | [<pyETT.ett.Match.Round object at 0x7f27ca6aa7... |
914 | 2021-02-20T18:53:27.768Z | 4833346 | False | 3 | 1 | 1 | 0 | 0 | 0 | 0.0 | 2912.0 | 2936.0 | twISTer1979 | alexttbcn | [<pyETT.ett.Match.Round object at 0x7f27ca6aa8... |
915 | 2021-02-20T18:53:48.819Z | 4833362 | True | 3 | 1 | 1 | 0 | 0 | 0 | 6.0 | 2912.0 | 2936.0 | twISTer1979 | alexttbcn | [<pyETT.ett.Match.Round object at 0x7f27ca6aa9... |
916 rows × 15 columns
We observed the the top 10 players played an impressive 916 number of matches among each other. To obtain match up analytics of players in the cohort, we can call the method describe()
:
[7]:
lb_cohort.describe()
[7]:
index | num_matches | wins | losses | win_rate | num_matches_ranked | wins_ranked | losses_ranked | win_rate_ranked | elo | rank | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | Aiphaton | 311 | 208 | 103 | 67.0 | 143 | 98 | 45 | 69.0 | 3204.0 | 1 |
1 | yedat | 202 | 125 | 77 | 62.0 | 179 | 110 | 69 | 61.0 | 2994.2 | 10 |
2 | wurstfriedl | 112 | 38 | 74 | 34.0 | 23 | 12 | 11 | 52.0 | 3028.0 | 6 |
3 | PROTT_VR | 227 | 116 | 111 | 51.0 | 222 | 115 | 107 | 52.0 | 3134.0 | 2 |
4 | Seldon36 | 87 | 38 | 49 | 44.0 | 34 | 17 | 17 | 50.0 | 3114.3 | 3 |
5 | Lapoctopus | 242 | 120 | 122 | 50.0 | 175 | 80 | 95 | 46.0 | 3069.1 | 5 |
6 | sunking73 | 63 | 31 | 32 | 49.0 | 50 | 21 | 29 | 42.0 | 2995.5 | 7 |
7 | fmwallin | 212 | 90 | 122 | 42.0 | 147 | 59 | 88 | 40.0 | 3072.0 | 4 |
8 | twISTer1979 | 249 | 98 | 151 | 39.0 | 110 | 39 | 71 | 35.0 | 2960.6 | 9 |
9 | alexttbcn | 127 | 52 | 75 | 41.0 | 43 | 12 | 31 | 28.0 | 2958.0 | 12 |
We observe that the player PROTTVR
(ranked 2) played the most ranked matches against Top 10 ranked players with a total of 222 matches followed by yedat
with 179 matches. The player with the highest win rate when playing against other Top 10 ranked players is Aiphaton
, the current World’s number 1, followed by yedat
, formerly ranked number 1.