-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExDatabaseWrite.py
More file actions
executable file
·65 lines (51 loc) · 1.52 KB
/
Copy pathExDatabaseWrite.py
File metadata and controls
executable file
·65 lines (51 loc) · 1.52 KB
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
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 06 15:00:17 2018
@author: Dhairyya
SQLIte database connection to read
"""
import sqlite3
import matplotlib.pyplot as plt
connection=sqlite3.connect("myTable.db")
crsr=connection.cursor()
#crsr.execute("SELECT Distinct name from pvalue WHERE name=?",("Rohit Sharma",))
crsr.execute("SELECT DISTINCT name from fieldValue")
#crsr.execute("SELECT DISTINCT name from IPLFieldValue2018")
data=crsr.fetchall()
players=[]
p=[]
value=[]
for row in data:
name = row[0].encode("ascii")
players.append(name)
for player in players:
crsr.execute("SELECT * from fieldValue WHERE name=?",(player,))
#crsr.execute("SELECT * from IPLFieldValue2018 WHERE name=?",(player,))
data=crsr.fetchall()
total=0
count=0
for row in data:
total=total+(row[2]*row[4])
# total=total+(row[2]*row[3])
p.append(player)
value.append(total)
xaxis=[]
yaxis=[]
i=0
while i<10:
mval=max(value)
pos=value.index(mval)
if p[pos]!='su' and p[pos]!='&':
print p[pos]+" "+str(value[pos])
xaxis.append(value[pos])
yaxis.append(p[pos])
if p[pos]=='su' or p[pos]=='&':
i=i-1
p.remove(p[pos])
value.remove(value[pos])
i=i+1
plt.plot(xaxis,yaxis,color="green",linestyle="dashed",linewidth=1,marker='o',markerfacecolor='red',markersize=5)
plt.ylabel('player name')
plt.xlabel('fielding value')
plt.title('Fielding value of player IPL 2017 & 2016')
plt.show()