Preparation


In [8]:
%run Preparation.ipynb

In [9]:
rmdf152 = pd.read_csv("data/2017-06-28.fes-a.csv")

relevantColumns = ['id', 'playerId', 'serverTime', 'customData.localplayerguid', 'customData.platform']

part152 = rmdf152.loc[:,relevantColumns]

df = part152

Filter out by date - during the event


In [12]:
startTime = "2017-06-08T09:30:00.000Z"
endTime = "2017-06-10T19:10:00.000Z"

duringFESDf = rmdf152[(rmdf152['serverTime'] > startTime) & (rmdf152['serverTime'] < endTime)]
duringFESDf = duringFESDf.loc[:,relevantColumns]

sessionscount = duringFESDf["playerId"].nunique()
sessionscount


Out[12]:
35

In [13]:
#players = duringFESDf['customData.localplayerguid', 'customData.platform'].dropna(how='any').unique()
#players = duringFESDf.loc[:,['customData.localplayerguid', 'customData.platform']].dropna(how='any').unique()
players = duringFESDf.loc[:,['customData.localplayerguid', 'customData.platform']]
players = players.dropna(how='any')
#players = players.unique()
players


Out[13]:
customData.localplayerguid customData.platform
4418 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
4521 "7cece567-45d0-42e7-9870-3f83fb7de271" "android"
4532 "3fcead86-5cd4-459d-bc0f-b98c39a3bcfc" "webglplayer"
4664 "257b955f-0252-46a8-9089-e37ad2d53f04" "webglplayer"
4719 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
4853 "6c9c2b7c-0e2e-41a1-89a7-f21d3705270c" "webglplayer"
5004 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
5037 "def83f22-6d18-437f-8dc5-c7bdabf79099" "webglplayer"
5039 "def83f22-6d18-437f-8dc5-c7bdabf79099" "webglplayer"
5108 "08303535-5aee-4748-b901-f5fd0b2a26d8" "webglplayer"
5110 "297708ce-a29e-4e3f-a6f4-94c5e9e02f96" "webglplayer"
5112 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
5113 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
5133 "9880ce9d-c6fc-476e-98a9-a9e8c8f7fcdc" "android"
5301 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
5314 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
5315 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
5364 "58011e25-5877-407a-99a4-5b6686be2c85" "webglplayer"
5371 "58011e25-5877-407a-99a4-5b6686be2c85" "webglplayer"
5421 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
5422 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
5714 "91109971-ffb1-471d-9ce3-4fc47e38ad1f" "webglplayer"
6337 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
6456 "75e264d6-af94-4975-bb18-50cac09894c4" "webglplayer"
6479 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
6497 "c032ad4c-4583-4f88-915d-e2fe114d2598" "webglplayer"
6512 "a2d9b465-4329-47e6-9404-a62ee1bf3f9b" "webglplayer"
6513 "a2d9b465-4329-47e6-9404-a62ee1bf3f9b" "webglplayer"
6514 "95ead482-b6fd-4f1a-b0fb-13b348a13833" "webglplayer"
6517 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
6931 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
6932 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
7119 "257b955f-0252-46a8-9089-e37ad2d53f04" "webglplayer"
7379 "deb089c0-9be3-4b75-9b27-28963c77b10c" "linuxplayer"
7533 "c75c8aba-148f-4bc9-a543-b42a9b7920d9" "webglplayer"
7863 "57badcdc-95a3-4436-83fc-a15ea8314ec3" "webglplayer"
8183 "c8cb0a78-5060-4238-ba7a-94323a0f5f0d" "webglplayer"

In [14]:
playerscount = players.nunique()
playerscount


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-14-ffd67c255e0a> in <module>()
----> 1 playerscount = players.nunique()
      2 playerscount

/Users/raphik12/anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc in __getattr__(self, name)
   2244                 return self[name]
   2245             raise AttributeError("'%s' object has no attribute '%s'" %
-> 2246                                  (type(self).__name__, name))
   2247 
   2248     def __setattr__(self, name, value):

AttributeError: 'DataFrame' object has no attribute 'nunique'

In [ ]:


In [ ]:
#arcadeDf = df[customData.localplayerguid] == arcadeCabinetID;

Unique Game Sessions

Number of unique game sessions


In [ ]:
playerscount = df["playerId"].nunique()
playerscount

Number of unique devices ids


In [ ]:
localPlayerGuids = df.loc[:,['playerId', 'customData.localplayerguid']]
localPlayerGuids.columns= ['id', 'guid']
localPlayerGuids = localPlayerGuids[localPlayerGuids['guid'].notnull()]
localPlayerGuids = localPlayerGuids['guid']
localPlayerGuids.nunique()
localPlayerGuids.unique()

Duration

Duration of playing sessions


In [ ]:
durations = df.groupby("playerId").agg({ "serverTime": [ np.min, np.max  ] })
durations["duration"] = pd.to_datetime(durations["serverTime"]["amax"]) - pd.to_datetime(durations["serverTime"]["amin"])
durations["duration"] = durations["duration"].map(lambda x: np.timedelta64(x, 's'))
durations = durations.sort_values(by=['duration'], ascending=[False])
durations.head()

Duration plot


In [ ]:
durations.loc[:,'duration']
durations = durations[4:]
durations["duration_seconds"] = durations["duration"].map(lambda x: pd.Timedelta(x).seconds)
maxDuration = np.max(durations["duration_seconds"])
durations["duration_rank"] = durations["duration_seconds"].rank(ascending=False)
durations.plot(x="duration_rank", y="duration_seconds")
plt.xlabel("game session")
plt.ylabel("time played (s)")
plt.legend('')
plt.xlim(0, playerscount)
plt.ylim(0, maxDuration)
durations["duration_seconds"].describe()
durations.head()