-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
69 lines (54 loc) · 2.04 KB
/
main.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
from dao.dao import DAO
from grouped_stats import GroupedStats
from table import Table
from dates import next_day
from analysis import Analysis, CORRELATION_H1_H2, CORRELATION_H1_FULL, CORRELATION_H2_FULL
dao = DAO(country="england", season="15-16", cols="sport_cols")
stats = GroupedStats(dao.get_data())
print("")
table = Table(dao)
points = table.points()
print ("Final table")
print (points)
print()
### FIRST HALF LEAGUE
half_league_date = table.half_league_date()
print(half_league_date)
eng_points_h1 = table.points(to_date=half_league_date)
eng_points_h2 = table.points(from_date=next_day(half_league_date))
print("England First Half")
print(eng_points_h1.sort_values(by="Points", ascending=False))
print()
print("England Second Half")
print(eng_points_h2.sort_values(by="Points", ascending=False))
print()
print("Correlation between first half and second half points")
print("Corr pearson: ", eng_points_h1["Points"].corr(eng_points_h2["Points"], method="pearson"))
print("Corr spearman:", eng_points_h1["Points"].corr(eng_points_h2["Points"], method="spearman"))
print()
print("Correlation between first half and full league")
print("Corr pearson: ", eng_points_h1["Points"].corr(points["Points"], method="pearson"))
print("Corr spearman:", eng_points_h1["Points"].corr(points["Points"], method="spearman"))
print()
print("Correlation between second half and full league")
print("Corr pearson: ", eng_points_h2["Points"].corr(points["Points"], method="pearson"))
print("Corr spearman:", eng_points_h2["Points"].corr(points["Points"], method="spearman"))
print()
# #goals scored
# data["FTHG"].mean()
# data["FTAG"].mean()
# #shots
# data["HS"].mean()
# data["AS"].mean()
# #shots on target
# data["HST"].mean()
# data["AST"].mean()
# #rate shots on target / shots
# data["HST"].sum() / data["HS"].sum()
# data["AST"].sum() / data["AS"].sum()
# #rate goals / shots
# data["FTHG"].sum() / data["HS"].sum()
# data["FTAG"].sum() / data["AS"].sum()
# #rate goals / shots on target
# data["FTHG"].sum() / data["HST"].sum()
# data["FTAG"].sum() / data["AST"].sum()