Jeffery Russell 5 years ago
parent
commit
3d800c1c91
2 changed files with 386 additions and 2 deletions
  1. +355
    -0
      data_preparation/cleaned/fatigue_total_sum.csv
  2. +31
    -2
      data_preparation/vectorization_ex.py

+ 355
- 0
data_preparation/cleaned/fatigue_total_sum.csv View File

@ -0,0 +1,355 @@
,TimeSinceAugFirst,fatigueSum
0,0,0.7344574890035869
1,1,0.4851754722007276
2,2,0.28047459289987386
3,3,0.8528996720285117
4,4,0.06771812799773429
5,5,0.38726124826728237
6,6,0.4668151381247664
7,7,0.7637319478908893
8,8,0.6855120834803765
9,9,0.8951086560274633
10,10,-0.06186187112232838
11,11,0.2963219073909037
12,12,0.6231177621144958
13,13,0.7538292507958928
14,14,0.21787034421122503
15,15,0.5392684904608605
16,16,0.7348439424725517
17,17,0.3084691218711857
18,18,0.1670411353591235
19,19,0.7462678803405148
20,20,0.6227886527763683
21,21,0.2143201560580074
22,22,0.05082785784393374
23,23,0.29424679033220863
24,24,0.18680862419432184
25,25,0.552767197321023
26,26,0.7845417065855602
27,27,0.7794195508511091
28,28,0.7983573737310359
29,29,0.32312904046310925
30,30,0.14514380851555342
31,31,0.6848776416265696
32,32,0.5398747937715528
33,33,0.36321009791782977
34,34,0.48914820446583296
35,35,0.4132365429778073
36,36,0.39501189373141715
37,37,0.15683705077138557
38,38,-0.2855582184594008
39,39,-0.3496985399214124
40,40,-0.5587658361439648
41,41,0.7859411947792441
42,42,0.2608251361668858
43,43,0.17517332439518096
44,44,0.548662507988438
45,45,0.2523212311062572
46,46,0.742763716938104
47,47,0.5298725111377356
48,48,0.3704240285113799
49,49,0.16273339415336321
50,50,0.35710794662067674
51,51,0.012983087373204446
52,52,-0.03899796525449454
53,53,0.24108517993130238
54,54,0.2730510305728201
55,55,0.5012834549713512
56,56,0.35213155414989655
57,57,0.5103081825319213
58,58,0.40841696141170136
59,59,-0.3822596251715601
60,60,0.11178493384173875
61,61,0.6105782657414672
62,62,0.5638365796066905
63,63,0.38703815913988415
64,64,0.17691474265163973
65,65,-0.1584409744032508
66,66,-0.12780884688678903
67,67,0.1676751033705102
68,68,0.23241255411788467
69,69,-0.03403958674123605
70,70,0.36921913242084736
71,71,0.05516608110063374
72,72,-0.1591400757571597
73,73,-0.14381570504980845
74,74,0.30993129245096845
75,75,0.4817187006378433
76,76,0.5426959856634723
77,77,-0.5926098626069284
78,78,-0.08787176009022218
79,79,0.323133612277408
80,80,0.14592673804854944
81,81,0.2660684986755749
82,82,0.11289500622744879
83,83,0.11774653805839017
84,84,0.28998255862081274
85,85,0.1562687777248425
86,86,0.3369601944304925
87,87,0.21156851662268664
88,88,0.4056548888566286
89,89,-0.08065109476753157
90,90,-0.9895032129301133
91,91,-0.6185894832682024
92,92,-0.10635463331522474
93,93,-0.0367041670152624
94,94,-0.19906175862849756
95,95,-0.1653914049490471
96,96,0.4655597131519229
97,97,0.5537123641477566
98,98,0.10718598664191972
99,99,-0.1765203192376061
100,100,-0.01247174683911395
101,101,0.009238546030445893
102,102,0.031210965670767726
103,103,0.306981488185374
104,104,0.3265128063013286
105,105,0.3897899457874447
106,106,0.1633383925102647
107,107,0.43041006311015984
108,108,0.06452962128075361
109,109,-0.05664283933186226
110,110,0.3608106160730567
111,111,0.6744862356360053
112,112,0.20317761835016498
113,113,0.016482187327924346
114,114,0.645937951499796
115,115,-0.635636762766677
116,116,0.05426729872634844
117,117,0.19767824790576916
118,118,-0.037744729883123995
119,119,0.5101843862412544
120,120,0.456725618316876
121,121,0.3694272022261105
122,122,-0.3056942726076881
123,123,-1.0919116910209934
124,124,-0.726910533417431
125,125,-0.4388472873908896
126,126,0.029939288546349287
127,127,-0.06137110272940533
128,128,-0.24552813243807786
129,129,0.009470765956943406
130,130,-0.34178437060398775
131,131,-0.04991936535772925
132,132,0.09714317205897194
133,133,-0.011342193521126434
134,134,0.08042170320790365
135,135,-0.12900441771911692
136,136,-0.27085969616046635
137,137,-0.7089046464519477
138,138,-0.22900902626408856
139,139,-0.1814244389597814
140,140,-0.026564683920244823
141,141,0.2190654841184067
142,142,-0.5304390859264948
143,143,-0.739993065212586
144,144,-0.07814424732831397
145,145,0.2818062549870509
146,146,0.10632331261740126
147,147,0.4610515035246875
148,148,-0.1949608448773015
149,149,-1.032347147920899
150,150,-0.22170874963304332
151,151,-0.14609477120948897
152,152,-0.7698453057085761
153,153,-0.006930021908459132
154,154,-0.10464728372829608
155,155,-0.012381788872798885
156,156,-0.19121232166827026
157,157,-0.6715295272018171
158,158,-0.6163942244984447
159,159,-0.07394318293840786
160,160,0.05714764020354259
161,161,-0.3463306308733807
162,162,-0.08655944015928
163,163,-0.40820283723896816
164,164,-1.2890163326990187
165,165,-1.0620096921743887
166,166,-0.2390787073524069
167,167,-0.06959286135145615
168,168,-0.4705009743846203
169,169,-1.0235076040997462
170,170,-0.38241473575656176
171,171,-0.0919836761123891
172,172,0.01619412513544485
173,173,0.2085579252960514
174,174,0.3826314355942887
175,175,0.0546188605653523
176,176,0.39253931444369095
177,177,0.4073081770793248
178,178,0.5361087576086003
179,179,-0.559118537823889
180,180,-0.04127942580662245
181,181,-0.8119777793283375
182,182,-0.6731101391927786
183,183,-0.6471900326468963
184,184,-0.2640557591258382
185,185,0.21372067089260005
186,186,0.16953292967820452
187,187,0.5728231280292477
188,188,0.5041384981085575
189,189,-0.025148663593221068
190,190,0.2432561651688418
191,191,-0.028600242158835457
192,192,-0.4709730852987265
193,193,-0.40498016732413183
194,194,0.19268730744400392
195,195,0.2491234634614092
196,196,-0.09450139502181923
197,197,0.3301716423691231
198,198,0.30380891634516755
199,199,-0.2258951881744846
200,200,-0.3371851443622679
201,201,0.18456077399231852
202,202,0.10594506304863852
203,203,-0.26826349037309316
204,204,-0.6305855583314973
205,205,-0.45820684078774365
206,206,-0.49815805297679083
207,207,-0.029702307826457188
208,208,-0.06797976527748503
209,209,-0.6569256565250553
210,210,-0.45752927486509876
211,211,-0.27135218581134485
212,212,-1.1165563279167452
213,213,-0.6111669314465557
214,214,-0.6105273765267971
215,215,0.03438253013308448
216,216,-0.14131846494594386
217,217,0.0045112614690663855
218,218,-0.16449239501985058
219,219,-0.05686221199747391
220,220,0.010261586762042467
221,221,0.10108202461301764
222,222,0.37230079653950404
223,223,-0.1458749617004085
224,224,0.06072610620998051
225,225,-0.37105941221648064
226,226,-0.37067009222163605
227,227,0.08311952745889095
228,228,-0.05833898692975855
229,229,0.33629582774049993
230,230,0.5192651216991766
231,231,0.1696838266192163
232,232,0.07748684044191127
233,233,-0.4743646121345583
234,234,-0.24770226914026555
235,235,-0.6595954881299645
236,236,0.26240259376226943
237,237,-0.2779056699659787
238,238,-0.07385767855878048
239,239,0.053602846962544116
240,240,-0.606205677585295
241,241,-0.6240533185483063
242,242,-0.6058672242100481
243,243,-0.2529542976745638
244,244,-0.10133856985122752
245,245,0.13329935585054334
246,246,0.4164696355414681
247,247,-0.48865392999332996
248,248,0.145411566109825
249,250,-0.7273385231793927
250,251,0.12410412032198169
251,252,0.27674868329463415
252,253,0.7933817709056039
253,254,0.6430634141972724
254,255,1.0498918584797523
255,256,0.16433766740443653
256,257,0.1581754209003413
257,258,-0.3767844129570323
258,259,-1.13446825563484
259,260,-0.682110266582935
260,261,0.03890579636217944
261,262,0.25070534761643054
262,263,0.6308354888129499
263,264,-0.3811854765459816
264,265,-2.0947320525204836
265,266,-1.0842354860084216
266,267,-1.0043510999282745
267,268,-0.9692235311586099
268,269,-0.8451134775394933
269,270,-0.5423262674604377
270,271,-0.15428902367855632
271,272,-0.47818347594846994
272,273,-0.3061862272276976
273,274,0.13016558778888693
274,275,-0.5346074316667073
275,276,-0.024108562029164497
276,277,0.44135660385783515
277,278,0.8359742523934252
278,279,0.5047436125815261
279,280,0.6080841302618076
280,281,0.35428669835871673
281,282,0.1490984551391564
282,283,0.3628666490409816
283,284,0.5851070995519784
284,285,-0.23884955785828602
285,286,-1.2931620504440084
286,287,-0.5149710038459224
287,288,-0.13060527178434828
288,289,0.05460102315917359
289,290,0.7126540531525146
290,291,0.3454110915997969
291,292,0.5908276470938011
292,293,0.22617556533671632
293,294,0.06645643211862166
294,295,-0.24410962776969897
295,296,-0.6686078186408764
296,297,-0.8927537790976293
297,298,-0.8644506239971387
298,299,-0.0526291051689912
299,300,0.09787954027186502
300,301,0.06886122334331811
301,302,0.20130318055109625
302,303,-0.3433112649541869
303,304,-0.14959798865436585
304,305,0.15919756672149993
305,306,-0.1280300468277571
306,307,-0.8817613473908142
307,308,0.11091144515390736
308,309,-0.059481544970225834
309,310,0.24826104657910567
310,311,0.21782917177756106
311,312,-0.1687691177431938
312,313,-0.7343025362546837
313,314,-1.233666925895062
314,315,-0.4250094786650305
315,316,-0.23695666543827143
316,317,-0.13528794113346507
317,318,-0.21467610436495208
318,319,-0.2465124428901275
319,320,0.02001698597605328
320,321,-0.5611020124713038
321,322,-0.25833755332807773
322,323,-0.36020138367026094
323,324,-0.6767581793070323
324,325,-1.2232671693259605
325,326,-0.5524980778772826
326,327,-0.0593829242117204
327,328,-0.2301741460847353
328,329,-0.17812573297568593
329,330,-0.7822181509887379
330,331,-0.9027716053209451
331,332,-0.8341775858590699
332,333,-0.6237422947183584
333,334,0.029100211618237018
334,335,-0.2769984632439794
335,336,-0.4956169729129575
336,337,-0.16842928848013955
337,338,-0.21520559276700027
338,339,-0.40092940485044154
339,340,0.0014212864891760299
340,341,0.24764616251080407
341,342,-0.0198326678170691
342,343,0.41449646066539014
343,344,0.30521758335133714
344,345,0.2603758932210191
345,346,0.6435856062574784
346,347,0.5875025644973848
347,348,0.9333689916536452
348,349,0.5629340431788956
349,350,0.5822132331979378
350,351,0.5505608569805795
351,352,0.5982805951374118
352,353,0.7396982091655812
353,354,0.066689402177346

+ 31
- 2
data_preparation/vectorization_ex.py View File

@ -47,5 +47,34 @@ class WellnessCSV:
df.to_csv(self.end)
cls = WellnessCSV()
cls.vectorize()
class FatigueSum:
def __init__(self):
self.file = "cleaned/time_series_normalized_wellness.csv"
self.end = "cleaned/fatigue_total_sum.csv"
def calculate(self):
df = pd.read_csv(self.file)
# get some of the fatigue for a particular date
diction = dict()
dates = df["TimeSinceAugFirst"].unique()
dates = set(dates)
dates = list(dates)
# for each date, get unique data and get calculation
for date in dates:
pdf = df[df["TimeSinceAugFirst"] == date]
num_players = len(pdf["playerID"].unique())
fatigue_sum = pdf["normFatigue"].sum()
result = fatigue_sum / num_players
diction[date] = result
# Converting
dates = diction.keys()
values = diction.values()
final_df = pd.DataFrame()
final_df["TimeSinceAugFirst"] = dates
final_df["fatigueSum"] = values
final_df.to_csv(self.end)

Loading…
Cancel
Save