Setup


In [4]:
%matplotlib inline

In [5]:
import pandas

In [27]:
data = pandas.read_csv("OCTGN_stats_anonymized-2014-04-01.csv")

Dataset win classes


In [72]:
data.Result.value_counts()


Out[72]:
AgendaDefeat       101578
AgendaVictory       65679
FlatlineVictory     35629
ConcedeVictory       4340
Conceded             3966
DeckDefeat            659
Flatlined               2
DeckVictory             1
dtype: int64

In [65]:
data.Corporation.value_counts()


Out[65]:
Haas-Bioroid | Engineering the Future           46211
NBN | Making News                               43252
Weyland Consortium | Building a Better World    36341
Jinteki | Personal Evolution                    30957
Jinteki | Replicating Perfection                15394
NBN | The World Is Yours                        13904
Haas-Bioroid | Guarding the Net                  7012
Weyland Consortium | Because We Built It         6851
Haas-Bioroid | Stronger Together                 4152
Haas-Bioroid | Infinite Frontiers                3691
Haas-Bioroid | Engineered for Success            2451
Weyland Consortium | Power Unleashed             1469
Haas-Bioroid | Selective Mind Mapping              90
Jinteki | Selective Mind Mapping                   79
dtype: int64

In [67]:
data.Runner.value_counts()


Out[67]:
Shaper | Kate McCaffrey          40118
Criminal | Gabriel Santiago      38129
Anarch | Noise                   37292
Criminal | Andromeda             27648
Shaper | Chaos Theory            23569
Anarch | Whizzard                16444
Shaper | Rielle "Kit" Peddler    12299
Anarch | Reina Roja               8356
Shaper | Exile                    3995
Shaper | The Professor            3225
Shaper | The Collective            422
Criminal | Laramy Fisk             357
dtype: int64

Histograms

Corporate Victories, Agendas versus Flatline


In [114]:
plots=[data.Turns_Played.plot(title="Corporate Victories", legend=True, label="Turns Played", kind='hist', bins=range(1,60)),
 data.Turns_Played[data.Result=="AgendaVictory"].plot(legend=True,
                                                      label="Agenda Victory",
                                                      kind='hist', bins=range(1,60)),
 data.Turns_Played[data.Result=="FlatlineVictory"].plot(legend=True,
                                                     label="Flatline Victory",
                                                     kind='hist', bins=range(1,60))]
plots[1].set_xlabel("Turns")
plots[1].set_ylabel("Games")


Out[114]:
<matplotlib.text.Text at 0x7fc802540790>

Runner Victories compared to Corporate Agenda Victories


In [111]:
plots=[data.Turns_Played.plot(title="Corporation and Runner Agenda Victories", legend=True, label="Turns Played", kind='hist', bins=range(1,60)),
 data.Turns_Played[data.Result=="AgendaDefeat"].plot(legend=True,
                                                      label="Runner Victory",
                                                      kind='hist', bins=range(1,60)),
  data.Turns_Played[data.Result=="AgendaVictory"].plot(legend=True,
                                                      label="Corporate Agenda Victory",
                                                      kind='hist', bins=range(1,60))]
plots[1].set_xlabel("Turns")
plots[1].set_ylabel("Games")


Out[111]:
<matplotlib.text.Text at 0x7fc803c12710>

Corporate Victories compared to Runner Victories


In [110]:
plots=[data.Turns_Played[data.Result=="AgendaDefeat"].plot(title="Corporation and Runner Total Victories",
                                                     legend=True,
                                                      label="Runner Victory",
                                                      x="Turns",
                                                      y="Games",
                                                      kind='hist', bins=range(1,60)),
  data.Turns_Played[(data.Result=="AgendaVictory") | (data.Result=="FlatlineVictory")].plot(legend=True,
                                                      label="Corporate Victory",
                                                      alpha=.5,
                                                      kind='hist', bins=range(1,60))]
plots[1].set_xlabel("Turns")
plots[1].set_ylabel("Games")


Out[110]:
<matplotlib.text.Text at 0x7fc803baad10>

Differences in Scores


In [113]:
plots=[(data.Corp_Score - data.Runner_Score)[data.Result=="AgendaVictory"].plot(title="Difference in Scores",
                                                     legend=True,
                                                     alpha=.5,
                                                      label="Corp Win",
                                                      kind='hist', bins=range(-10,10)),
       (data.Corp_Score - data.Runner_Score)[(data.Result=="AgendaDefeat")].plot(title="Difference in Scores",
                                                     legend=True,
                                                     alpha=.5,
                                                      label="Runner Win",
                                                      kind='hist', bins=range(-10,10))]
plots[1].set_xlabel("Corp - Runner")
plots[1].set_ylabel("Games")


Out[113]:
<matplotlib.text.Text at 0x7fc802ebaa90>

Wins per player


In [116]:
player_wins = {}
for player in set(data.Corp_Player).union(data.Runner_Player):
    player_wins[player] = 0

In [134]:
for i, entry in data.iterrows():
    if entry.Win:
        player_wins[entry.Corp_Player] += 1
    else:
        player_wins[entry.Runner_Player] += 1

In [137]:
df=pandas.DataFrame(player_wins.items(), columns=["id","wins"])

In [142]:
df.wins.plot(kind="hist",bins=range(1,30))


Out[142]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fc803d33890>

In [ ]: