-
Notifications
You must be signed in to change notification settings - Fork 0
/
lol.py
161 lines (89 loc) · 2.32 KB
/
lol.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from collections import defaultdict
data = pd.read_csv('LeagueofLegends.csv')
bres=data.bResult
rres=data.rResult
bkills=data.bKills
rkills=data.rKills
data_kills=pd.read_csv('kills.csv')
kills_x_locations=data_kills.x_pos
kills_y_locations=data_kills.y_pos
kill_time=data_kills.Time
killer_id=data_kills.Killer
victim_id=data_kills.Victim
killer_list=pd.Series.tolist(killer_id)
fq= defaultdict( int )
for killer_1 in killer_list:
fq[killer_1] += 1
inv_killer_map = {v: k for k, v in fq.iteritems()}
ordered_kill_totals=sorted(inv_killer_map.keys(),reverse=True)
topkillers=[]
for key in ordered_kill_totals:
topkillers.append(inv_killer_map[key])
objects=topkillers[0:19]
y_pos = np.arange(len(objects))
performance=ordered_kill_totals[0:19]
print performance
fig = plt.figure()
labels=objects
plt.bar(objects,performance)
##plt.xticks(y_pos, objects)
##
plt.xlabel('Players')
plt.title('Kill totals')
##ax.legend(loc='best', fontsize=25)
##
##
plt.xticks(objects, labels, rotation='vertical')
plt.show()
##A=map(float,data_kills)
##print max(kill_time)
##kills_x_y=zip(data_kills.x_pos,data_kills.y_pos)
##print kills_x_y
def maximum2(a, n):
if n == 1:
return a[0]
x = maximum2(a[n//2:], n - n//2)
return x if x > a[0] else a[0]
def maximum(a):
return maximum2(a, len(a))
def minimum2(a, n):
if n == 1:
return a[0]
x = minimum2(a[n//2:], n - n//2)
return x if x < a[0] else a[0]
def minimum(a):
return minimum2(a, len(a))
x_kills=pd.Series.tolist(kills_x_locations)
##print x_kills
y_kills=pd.Series.tolist(kills_y_locations)
print sum(data.bResult)
print sum(data.rResult)
x_kills_new=[]
y_kills_new=[]
killer=[]
for ele in range(len(x_kills)-1):
ele1= x_kills[ele]
ele2= y_kills[ele]
ele3=kill_time[ele]
if ele1!='TooEarly' and ele2!='TooEarly' and float(ele3)<=11:
if ele1=='nan':
print 'Yes'
x_kills_new.append(float(ele1))
y_kills_new.append(float(ele2))
##for ele in x_kills:
## if ele==float('NaN'):
## print 'Yes'
##print max(x_kills_new)
##
##print max(y_kills_new)
##
##print min(x_kills_new)
##
##print min(y_kills_new)
##
##plt.hexbin(x_kills_new,y_kills_new,bins=100)
##
##plt.show()