import pandas
from IPython.core.display import display, HTML
idx = pandas.IndexSlice
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns;
sns.set_palette('deep')
import matplotlib
matplotlib.rcParams['animation.writer'] = 'avconv'
import matplotlib.animation
panel = pandas.read_pickle('championgg-data/alldata.pickle')
panel
<class 'pandas.core.panel.Panel'> Dimensions: 33 (items) x 242 (major_axis) x 18 (minor_axis) Items axis: 5.10 to 6.18 Major_axis axis: (Aatrox, Jungle) to (Zyra, Support) Minor_axis axis: winPercent to overallPositionChange
means = panel.mean().transpose()
means
winPercent | playPercent | banRate | experience | kills | deaths | assists | KDA | largestKillingSpree | totalDamageDealtToChampions | totalDamageTaken | totalHeal | minionsKilled | neutralMinionsKilledEnemyJungle | neutralMinionsKilledTeamJungle | goldEarned | overallPosition | overallPositionChange | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5.10 | 49.961587 | 4.987513 | 4.629259 | 68.630794 | 6.282593 | 6.121376 | 9.171005 | 2.562896 | 2.866772 | 20875.084656 | 26243.206349 | 4733.322751 | 137.981481 | 3.509524 | 18.625026 | 11898.529101 | 22.338624 | -0.317460 |
5.11 | 50.148936 | 5.004415 | 4.986011 | 70.414894 | 6.190319 | 6.035851 | 9.085372 | 2.572097 | 2.844468 | 20670.148936 | 26103.531915 | 4699.585106 | 137.960638 | 3.518298 | 18.700745 | 11862.553191 | 22.154255 | 0.000000 |
5.12 | 50.023172 | 5.065968 | 5.044892 | 68.761075 | 6.181989 | 5.974892 | 8.840376 | 2.554110 | 2.855806 | 20391.618280 | 25624.618280 | 4609.290323 | 137.862903 | 3.485699 | 18.525054 | 11759.048387 | 22.182796 | 0.000000 |
5.13 | 49.744842 | 4.959684 | 5.254316 | 68.244842 | 5.991684 | 5.908316 | 8.747263 | 2.530527 | 2.774368 | 19703.257895 | 25353.268421 | 4711.889474 | 136.313684 | 3.523105 | 18.560211 | 11674.084211 | 22.342105 | -0.036842 |
5.14 | 49.929519 | 5.021176 | 4.673316 | 70.963048 | 5.948128 | 5.916578 | 8.844064 | 2.536590 | 2.746578 | 19427.711230 | 25128.438503 | 4636.620321 | 133.017647 | 3.509144 | 18.375294 | 11581.818182 | 21.561497 | 0.000000 |
5.15 | 49.751123 | 5.024385 | 4.542781 | 71.477701 | 5.948182 | 5.923262 | 8.818930 | 2.529990 | 2.745294 | 19234.197861 | 24834.823529 | 4637.973262 | 131.613904 | 3.496684 | 18.184064 | 11515.245989 | 21.540107 | 0.000000 |
5.16 | 49.754840 | 4.978191 | 4.562074 | 71.246277 | 6.031862 | 6.021277 | 9.072872 | 2.548748 | 2.767819 | 19765.526596 | 25359.138298 | 4737.973404 | 129.468617 | 3.596649 | 18.670266 | 11563.180851 | 21.441489 | 0.000000 |
5.17 | 49.952447 | 4.980053 | 4.150106 | 70.160904 | 6.057394 | 6.039787 | 9.195319 | 2.561447 | 2.778617 | 19812.111702 | 25352.909574 | 4689.207447 | 129.730851 | 3.586277 | 18.475319 | 11584.478723 | 21.473404 | 0.000000 |
5.18 | 49.959144 | 4.991390 | 4.204118 | 72.353690 | 6.187433 | 6.158235 | 9.280160 | 2.546475 | 2.812353 | 20021.754011 | 25790.406417 | 4795.951872 | 130.957754 | 3.628021 | 18.594332 | 11683.502674 | 21.524064 | 0.000000 |
5.19 | 49.913763 | 5.035645 | 4.323925 | 74.972097 | 6.147688 | 6.145538 | 9.306290 | 2.550348 | 2.803065 | 20055.306452 | 25906.462366 | 4859.973118 | 131.878495 | 3.706828 | 18.761237 | 11721.247312 | 21.349462 | 0.000000 |
5.20 | 50.073789 | 4.928526 | 4.601737 | 73.695105 | 6.067000 | 6.048526 | 9.127789 | 2.547150 | 2.784684 | 19867.847368 | 25637.710526 | 4872.189474 | 131.713684 | 3.748105 | 18.634947 | 11627.847368 | 21.452632 | -0.221053 |
5.21 | 50.080684 | 4.940895 | 4.702737 | 72.858158 | 6.071737 | 6.080526 | 9.145368 | 2.537589 | 2.782842 | 20014.094737 | 25761.036842 | 4929.484211 | 132.297368 | 3.797158 | 18.709579 | 11655.678947 | 21.452632 | 0.000000 |
5.22 | 49.886071 | 4.688010 | 4.608265 | 70.271020 | 5.892806 | 5.901735 | 8.206122 | 2.434008 | 2.758418 | 18404.933673 | 23992.357143 | 5111.821429 | 120.341327 | 3.481837 | 16.475102 | 11489.831633 | 22.510204 | 0.000000 |
5.23 | 49.920102 | 4.707665 | 4.926091 | 70.046193 | 5.992284 | 5.973452 | 8.281168 | 2.431743 | 2.788579 | 18847.065990 | 24395.939086 | 5608.406091 | 124.198985 | 3.529442 | 17.300355 | 11686.832487 | 22.639594 | -0.142132 |
5.24 | 50.067839 | 4.665126 | 5.195829 | 72.513266 | 6.067638 | 6.138844 | 8.509950 | 2.413282 | 2.782915 | 18881.904523 | 24531.899497 | 5569.030151 | 123.765327 | 3.621608 | 17.672864 | 11834.809045 | 22.889447 | 0.000000 |
6.01 | 49.805354 | 4.682273 | 5.084798 | 73.810303 | 6.093081 | 6.219091 | 8.549091 | 2.389985 | 2.782727 | 19252.272727 | 25297.474747 | 5838.287879 | 127.138889 | 3.784343 | 18.260101 | 12053.737374 | 22.969697 | 0.000000 |
6.02 | 49.499400 | 4.721950 | 0.000000 | 56.155800 | 5.757300 | 5.847150 | 8.296500 | 2.441301 | 2.711350 | 18865.715000 | 24962.170000 | 5867.890000 | 128.649000 | 3.784150 | 19.313100 | 11922.295000 | 23.195000 | 0.000000 |
6.03 | 49.352386 | 4.768122 | 0.000000 | 44.323706 | 5.710406 | 5.801624 | 8.256853 | 2.447580 | 2.697107 | 19031.629442 | 25122.756345 | 6015.309645 | 133.003046 | 3.835990 | 19.170305 | 12023.309645 | 23.055838 | 0.000000 |
6.04 | 49.468827 | 4.795357 | 0.000000 | 48.447806 | 5.649694 | 5.682602 | 8.229337 | 2.481575 | 2.698418 | 18991.846939 | 25061.795918 | 5980.510204 | 133.330612 | 3.935204 | 19.860612 | 12006.209184 | 22.964286 | 0.000000 |
6.05 | 49.649323 | 4.880104 | 4.331406 | 49.388021 | 5.764844 | 5.780104 | 8.228333 | 2.458066 | 2.729948 | 19264.505208 | 25242.375000 | 5994.692708 | 134.698438 | 3.867813 | 18.817760 | 12047.260417 | 22.276042 | 0.000000 |
6.06 | 49.726497 | 4.773147 | 4.585838 | 46.059645 | 5.835584 | 5.822030 | 8.273249 | 2.461417 | 2.758832 | 19504.055838 | 25518.319797 | 6047.690355 | 134.117766 | 3.889086 | 19.204213 | 12081.604061 | 23.005076 | -0.370558 |
6.07 | 49.721040 | 4.646535 | 4.693020 | 56.345644 | 5.753020 | 5.781881 | 8.334257 | 2.473012 | 2.720644 | 20417.460396 | 26514.559406 | 5969.445545 | 130.905941 | 3.827624 | 19.043218 | 11925.227723 | 23.173267 | 0.000000 |
6.08 | 49.887665 | 4.729086 | 4.538376 | 59.179391 | 5.657614 | 5.611371 | 8.102589 | 2.490676 | 2.721726 | 18853.949239 | 24466.005076 | 5713.568528 | 132.478173 | 3.771827 | 18.568426 | 11773.147208 | 23.131980 | 0.000000 |
6.09 | 49.973618 | 4.671457 | 4.884271 | 61.197990 | 5.920754 | 5.880854 | 8.534322 | 2.500963 | 2.781206 | 19785.035176 | 25983.854271 | 6426.778894 | 134.725628 | 3.852111 | 19.113920 | 12095.738693 | 23.311558 | 0.000000 |
6.10 | 49.859261 | 4.590246 | 5.290788 | 63.019754 | 5.981330 | 5.983399 | 8.671675 | 2.488816 | 2.782906 | 20178.699507 | 26103.049261 | 6306.147783 | 136.313300 | 3.869803 | 19.006749 | 12200.103448 | 23.876847 | -0.044335 |
6.11 | 49.892315 | 4.613990 | 5.023103 | 63.944138 | 6.080640 | 6.049458 | 8.764828 | 2.490703 | 2.814877 | 20212.408867 | 26251.950739 | 6336.305419 | 135.088670 | 3.960394 | 19.282709 | 12225.093596 | 23.857143 | 0.000000 |
6.12 | 49.933627 | 4.584216 | 4.844804 | 70.828186 | 6.009657 | 6.011520 | 8.693431 | 2.481522 | 2.785931 | 19723.348039 | 25877.715686 | 6185.338235 | 132.616667 | 3.929363 | 19.300588 | 12107.882353 | 23.769608 | 0.000000 |
6.13 | 49.903000 | 4.698700 | 4.531900 | 69.611900 | 6.197050 | 6.132050 | 8.738300 | 2.470374 | 2.845550 | 20438.365000 | 27019.755000 | 6652.915000 | 135.666000 | 4.176450 | 20.880800 | 12477.450000 | 23.600000 | 0.000000 |
6.14 | 50.093682 | 4.682886 | 4.390597 | 66.333284 | 6.189154 | 6.094726 | 8.781393 | 2.493870 | 2.853582 | 20002.199005 | 26539.636816 | 6505.368159 | 132.946269 | 4.139403 | 20.933234 | 12338.422886 | 23.527363 | 0.000000 |
6.15 | 49.884450 | 4.710550 | 4.284250 | 69.349500 | 6.189200 | 6.132450 | 8.758600 | 2.473616 | 2.836350 | 19941.875000 | 26481.050000 | 6364.870000 | 132.318500 | 4.137500 | 20.876900 | 12334.645000 | 23.360000 | 0.000000 |
6.16 | 49.839208 | 4.666881 | 4.401584 | 72.667624 | 6.226287 | 6.178119 | 8.826337 | 2.472535 | 2.842178 | 20074.311881 | 26657.475248 | 6352.000000 | 130.752970 | 4.175842 | 21.151089 | 12325.336634 | 23.702970 | -0.212871 |
6.17 | 49.905226 | 4.739799 | 4.281407 | 65.080503 | 6.238040 | 6.193618 | 8.836985 | 2.469094 | 2.840000 | 20035.221106 | 26688.778894 | 6372.130653 | 131.813568 | 4.188492 | 21.084573 | 12371.648241 | 23.221106 | 0.000000 |
6.18 | 49.999749 | 4.737739 | 4.188141 | 65.084422 | 6.288291 | 6.252462 | 8.879950 | 2.460653 | 2.848291 | 20160.869347 | 26723.678392 | 6256.150754 | 131.867839 | 4.229095 | 20.856884 | 12405.286432 | 23.185930 | 0.000000 |
fig, axs = plt.subplots(figsize=(10,7), ncols=4, nrows=4)
for i, c in enumerate(panel['6.17'].columns[:16]):
row, col = int(i/4), i%4
g = means[c].plot(ax=axs[row, col])
g.set(title=c)
fig.tight_layout(pad=0, h_pad=0.5)
Text dump; time series of play percent for every champion
df = panel.xs('playPercent', axis=2)
df.sortlevel(inplace=True)
report = df.loc[idx[:,['Support']], :].transpose()
report.sortlevel(level=1)
Champion | Alistar | Annie | Bard | Blitzcrank | Brand | Braum | Fiddlesticks | Galio | Janna | Karma | ... | Soraka | Tahm Kench | Taliyah | Taric | Thresh | Trundle | Veigar | Vel'Koz | Zilean | Zyra |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Role | Support | Support | Support | Support | Support | Support | Support | Support | Support | Support | ... | Support | Support | Support | Support | Support | Support | Support | Support | Support | Support |
5.10 | 11.79 | 5.28 | 7.09 | 11.73 | 0.73 | 8.26 | NaN | 0.11 | 20.46 | 3.22 | ... | 4.46 | NaN | NaN | 1.86 | 41.14 | NaN | NaN | 1.42 | 0.55 | 1.90 |
5.11 | 13.26 | 5.17 | 8.11 | 12.28 | 0.76 | 7.68 | NaN | 0.13 | 20.03 | 2.59 | ... | 4.76 | NaN | NaN | 1.81 | 41.03 | NaN | NaN | 1.37 | 0.56 | 1.87 |
5.12 | 14.09 | 5.35 | 7.99 | 12.62 | 0.81 | 9.92 | NaN | NaN | 20.25 | 2.33 | ... | 5.01 | NaN | NaN | 1.72 | 39.85 | NaN | NaN | 1.26 | 0.71 | 1.74 |
5.13 | 13.10 | 4.37 | 5.51 | 13.22 | 0.95 | 9.48 | 0.30 | NaN | 20.91 | 1.88 | ... | 5.57 | 10.16 | NaN | 1.43 | 37.75 | NaN | NaN | 1.21 | 0.59 | 1.72 |
5.14 | 13.16 | 4.30 | 4.63 | 14.61 | 1.09 | 10.47 | 0.30 | 0.17 | 23.53 | 2.31 | ... | 5.87 | 5.56 | NaN | 1.46 | 38.21 | 0.35 | NaN | 1.15 | 0.57 | 1.60 |
5.15 | 12.14 | 4.16 | 4.11 | 16.07 | 1.21 | 11.47 | 0.28 | 0.18 | 23.69 | 2.02 | ... | 6.92 | 3.69 | NaN | 1.44 | 39.17 | 0.70 | NaN | 1.12 | 0.70 | 1.54 |
5.16 | 11.55 | 3.99 | 3.88 | 17.77 | 1.12 | 14.68 | 0.27 | 0.15 | 21.35 | 1.74 | ... | 6.93 | 3.21 | NaN | 1.36 | 37.31 | 0.42 | NaN | 1.30 | 0.68 | 1.64 |
5.17 | 10.38 | 3.82 | 4.65 | 17.51 | 1.31 | 18.19 | 0.31 | 0.12 | 18.85 | 1.95 | ... | 8.90 | 3.30 | NaN | 1.31 | 36.93 | NaN | NaN | 1.22 | 0.78 | 1.69 |
5.18 | 9.69 | 3.73 | 5.05 | 18.55 | 1.54 | 16.67 | 0.30 | 0.15 | 16.25 | 1.83 | ... | 9.46 | 3.63 | NaN | 1.18 | 36.86 | NaN | NaN | 1.27 | 0.96 | 2.06 |
5.19 | 10.27 | 4.11 | 4.61 | 17.45 | 2.20 | 18.27 | 0.30 | NaN | 15.28 | 1.87 | ... | 9.91 | 4.55 | NaN | 1.28 | 38.63 | NaN | NaN | 1.21 | 1.07 | 1.76 |
5.20 | 10.46 | 3.90 | 4.28 | 16.28 | 2.81 | 16.43 | 0.25 | 0.13 | 14.41 | 1.60 | ... | 8.82 | 9.25 | NaN | 1.24 | 37.47 | NaN | NaN | 1.14 | 1.14 | 1.70 |
5.21 | 12.56 | 3.58 | 4.13 | 16.94 | 3.13 | 14.55 | 0.26 | 0.13 | 13.93 | 1.66 | ... | 8.73 | 8.34 | NaN | 1.27 | 37.00 | NaN | NaN | 1.15 | 3.15 | 1.70 |
5.22 | 9.44 | 3.30 | 4.29 | 16.34 | 5.22 | 11.85 | 0.32 | 0.15 | 15.32 | 2.36 | ... | 16.05 | 7.54 | NaN | 2.43 | 31.88 | NaN | NaN | 1.46 | 1.86 | 1.85 |
5.23 | 8.92 | 2.96 | 6.39 | 16.76 | 9.46 | 11.02 | 0.30 | 0.13 | 14.26 | 2.33 | ... | 12.45 | 6.98 | NaN | 2.61 | 31.18 | NaN | NaN | 1.75 | 2.22 | 2.06 |
5.24 | 8.23 | 2.89 | 10.78 | 16.67 | 9.50 | 10.39 | 0.28 | 0.14 | 14.22 | 2.39 | ... | 8.49 | 4.55 | NaN | 1.96 | 30.81 | 1.01 | NaN | 1.87 | 2.31 | 2.27 |
6.01 | 11.29 | 2.36 | 9.40 | 14.93 | 6.59 | 10.63 | 0.38 | 0.15 | 15.20 | 2.04 | ... | 7.61 | 3.32 | NaN | 1.93 | 29.81 | 3.18 | NaN | 1.81 | 1.86 | 2.19 |
6.02 | 15.52 | 1.80 | 8.39 | 14.02 | 3.67 | 13.43 | NaN | 0.10 | 18.68 | 2.04 | ... | 7.59 | 2.61 | NaN | 1.68 | 30.21 | 2.23 | NaN | 1.51 | 1.90 | 2.27 |
6.03 | 17.57 | 1.68 | 7.94 | 13.80 | 2.61 | 14.34 | NaN | 0.13 | 21.86 | 1.95 | ... | 8.44 | 3.15 | NaN | 1.79 | 29.07 | 1.23 | NaN | 1.36 | 2.40 | 2.24 |
6.04 | 18.29 | 1.59 | 8.66 | 13.20 | 2.20 | 15.80 | NaN | 0.11 | 23.66 | 2.24 | ... | 9.58 | 2.67 | NaN | 1.72 | 26.89 | 0.95 | NaN | 1.43 | 2.23 | 2.41 |
6.05 | 17.28 | 1.55 | 10.35 | 13.05 | 2.06 | 16.51 | NaN | 0.14 | 21.78 | 2.17 | ... | 9.27 | 2.56 | NaN | 1.74 | 27.97 | 1.06 | NaN | 1.66 | 2.27 | 2.63 |
6.06 | 14.60 | 1.68 | 9.74 | 13.18 | 1.95 | 17.55 | NaN | 0.13 | 18.60 | 4.68 | ... | 10.96 | 2.29 | NaN | 1.90 | 28.54 | 1.32 | NaN | 1.59 | 2.22 | 2.57 |
6.07 | 16.45 | 1.65 | 9.97 | 15.35 | 1.79 | 16.89 | 0.21 | 0.13 | 15.98 | 4.42 | ... | 13.19 | 2.22 | NaN | 2.19 | 26.92 | 3.13 | NaN | 1.93 | 2.46 | 2.40 |
6.08 | 17.13 | 1.34 | 8.77 | 15.07 | 1.68 | 15.70 | 0.27 | NaN | 12.74 | 3.69 | ... | 11.84 | 2.33 | NaN | 17.98 | 24.06 | 3.96 | NaN | 1.98 | 2.31 | 2.27 |
6.09 | 19.16 | 2.23 | 8.43 | 16.10 | 4.07 | 15.44 | NaN | NaN | 11.17 | 3.72 | ... | 10.25 | 2.50 | NaN | 8.41 | 25.18 | 3.85 | 1.08 | 3.03 | 2.18 | 6.83 |
6.10 | 16.51 | 1.60 | 9.74 | 16.79 | 2.91 | 17.30 | NaN | NaN | 12.63 | 3.92 | ... | 10.41 | 1.85 | 1.30 | 5.58 | 26.04 | 3.23 | 0.84 | 1.95 | 2.39 | 5.66 |
6.11 | 13.45 | 1.38 | 11.62 | 17.11 | 2.37 | 17.00 | NaN | NaN | 13.53 | 5.17 | ... | 9.61 | 1.61 | 0.62 | 4.12 | 29.23 | 2.06 | 0.63 | 1.87 | 2.49 | 6.44 |
6.12 | 12.03 | 1.36 | 10.94 | 17.42 | 2.23 | 15.75 | NaN | NaN | 11.86 | 8.84 | ... | 9.35 | 1.48 | 0.44 | 3.19 | 29.48 | 1.92 | 0.59 | 1.94 | 2.73 | 6.70 |
6.13 | 7.98 | 1.31 | 10.11 | 13.60 | 2.58 | 14.28 | NaN | NaN | 16.72 | 9.17 | ... | 9.76 | 2.10 | NaN | 3.49 | 27.61 | NaN | NaN | 1.80 | 2.71 | 6.15 |
6.14 | 8.24 | 1.15 | 9.36 | 12.54 | 2.52 | 13.85 | NaN | NaN | 15.51 | 8.92 | ... | 10.56 | 1.67 | NaN | 3.37 | 24.80 | 0.80 | NaN | 1.88 | 2.64 | 4.23 |
6.15 | 8.46 | 1.18 | 10.06 | 12.05 | 2.68 | 12.76 | NaN | NaN | 16.73 | 8.13 | ... | 11.19 | 2.04 | NaN | 3.77 | 26.96 | 0.90 | NaN | 1.91 | 2.77 | 5.05 |
6.16 | 7.38 | 1.30 | 9.61 | 11.38 | 2.88 | 12.93 | NaN | NaN | 17.80 | 7.79 | ... | 11.59 | 2.31 | NaN | 4.48 | 26.75 | 0.79 | NaN | 2.09 | 2.69 | 4.61 |
6.17 | 7.39 | 1.25 | 10.84 | 11.46 | 3.09 | 14.14 | NaN | NaN | 17.71 | 7.39 | ... | 12.63 | 3.37 | NaN | 5.27 | 27.35 | 1.28 | NaN | 2.22 | 2.70 | 4.46 |
6.18 | 7.01 | 1.24 | 11.22 | 11.26 | 3.34 | 14.21 | NaN | NaN | 18.10 | 7.39 | ... | 12.92 | 3.37 | NaN | 4.69 | 28.31 | 1.27 | NaN | 2.19 | 2.78 | 4.50 |
33 rows × 33 columns
def makePlot(c, limits=None):
df = panel.xs(c, axis=2)
fig = plt.figure()
def animate(i):
plt.clf()
if i >= len(panel):
i = len(panel) - 1
df = panel.ix[i]
df['role'] = df.index.get_level_values(level=1)
plt.clf()
g = sns.violinplot(y=c, x='role', data=df, inner='stick')
g.set(title="%s for Patch %s" % (c, panel.items[i]), xlabel="", ylabel="")
if limits:
g.axes.set_ylim(limits[0], limits[1])
return g
return matplotlib.animation.FuncAnimation(fig, animate, frames=len(panel)+5, interval=250)
Inline a plot. Has a bug here; displayed twice. Maybe because no init function?
HTML(makePlot('playPercent', (0, 40)).to_html5_video())
Generate a lot of plots to local disk
for c, a, b in (('goldEarned', 7000, 15000),
('playPercent', 0, 40),
('winPercent', 40, 60),
('experience', 0, 400),
('KDA', 1, 5)):
makePlot(c, (a, b)).save('%s.mp4' % c)