-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_my_results.py
executable file
·60 lines (51 loc) · 1.79 KB
/
get_my_results.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from sitescraper import sitescraper
from pylab import *
import numpy
ss = sitescraper()
#url='http://basketball.fantasysports.yahoo.com/nba/86110/matchup?week=1&module=matchup'
url='http://basketball.fantasysports.yahoo.com/nba/86110/?matchup_week=2&module=matchupsmack&matchupsmacktab=m'
#data = [".451 ",".793","16","271","151","109","35","15"," 56",'<td class="stat"><strong>47</strong></td>',"7"]
data=[["FG%","FT%","3PTM","PTS","REB","AST","ST","BLK","TO","Score"], [".473 ",".716","44","441","210","105","34","20"," 88","6"]]
ss.add(url, data)
cur_week=ss.scrape('http://basketball.fantasysports.yahoo.com/nba/86110/matchup?week=2')
print cur_week
sys.exit(0)
#print(ss.scrape('http://basketball.fantasysports.yahoo.com/nba/87421/matchup?week=3&mid1=18&mid2=1'))
weeks=[]
for week_num in range(2,5) :
#for week_num in range(2,21) :
print week_num
cur_week=ss.scrape('http://basketball.fantasysports.yahoo.com/nba/86110/matchup?week='+str(week_num)+'&mid1=18&mid2=1')
weeks.append(cur_week[1])
# print(cur_week[1])
#print(weeks)
for cat in range(0,len(data[0])):
category=data[0][cat]
print(category)
y=[float(data[1][cat])]
for i in range(0,len(weeks)):
y.append(float(weeks[i][cat]))
print(weeks[i][cat]),
print("")
print("%.3f"%numpy.mean(y))
print("%.3f"%numpy.std(y))
print("")
# print(y)
# print(range(1,len(y)+1))
plot(range(1,len(y)+1),y)
axhline(y=numpy.mean(y), xmin=0, xmax=len(y)+1)
for k,l in zip(range(1,len(y)+1),y):
annotate(str(y[k-1]),xy=(k+0.1,l+0.1))
gca().set_ylim(bottom=0)
ylabel(category)
xlabel('weeks')
title(category)
gca().xaxis.set_major_locator(MultipleLocator(1))
#gca().yaxis.set_minor_locator(IndexLocator(1,1))
grid(True)
savefig(category+'.png')
close()
# show()