Last active
June 26, 2018 10:23
-
-
Save cavedave/bdd41d5756f68ee36cb1510dbf549de3 to your computer and use it in GitHub Desktop.
league results from premiership scraped off wikipedia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pos Pld W D L GF GA Pts | |
Pos 1.000000 0.355485 -0.891324 0.230178 0.923182 -0.797176 0.842297 -0.904020 | |
Pld 0.355485 1.000000 -0.073403 0.149353 0.257707 -0.040942 0.271909 -0.053488 | |
W -0.891324 -0.073403 1.000000 -0.413831 -0.878324 0.915376 -0.777565 0.989236 | |
D 0.230178 0.149353 -0.413831 1.000000 -0.007839 -0.339314 0.029156 -0.276164 | |
L 0.923182 0.257707 -0.878324 -0.007839 1.000000 -0.816503 0.878841 -0.928555 | |
GF -0.797176 -0.040942 0.915376 -0.339314 -0.816503 1.000000 -0.616188 0.911872 | |
GA 0.842297 0.271909 -0.777565 0.029156 0.878841 -0.616188 1.000000 -0.816231 | |
Pts -0.904020 -0.053488 0.989236 -0.276164 -0.928555 0.911872 -0.816231 1.000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.read_csv('premiership.csv', sep=',', encoding='utf-8', index_col=None) | |
df.head() | |
import numpy as np | |
df.corr() | |
f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row') | |
f.suptitle('Where to get Premier League Points') | |
#ax1 | |
ax1.scatter(df['Pts'], df['GF'], alpha=0.7, color='green') | |
ax1.set_xlabel('Points') | |
ax1.set_ylabel('Goals Scored') | |
ax1.text(75, 25, "corr 0.91",size=10) | |
#ax2 | |
ax2.scatter(df['Pts'], df['GA'], alpha=0.7) | |
#ax2.title('Premiership Goals Given Away Versus Points') | |
ax2.set_xlabel('Points') | |
ax2.set_ylabel('Goals Against') | |
ax2.text(72, 95, "corr -0.81",size=10) | |
#ax3 | |
ax3.scatter(df['Pts'], df['W'], alpha=0.5, color='red') | |
#ax3.title('Premiership Wins Versus Points') | |
ax3.set_xlabel('Points') | |
ax3.set_ylabel('Wins') | |
ax3.text(75, 2, "corr 0.99",size=10) | |
#ax4 | |
ax4.scatter(df['Pts'], df['D'], alpha=0.6, color='purple') | |
#ax4.title('Premiership Draws Versus Points') | |
ax4.set_xlabel('Points') | |
ax4.set_ylabel('Draws') | |
ax4.text(75, 28, "corr -.27",size=10) | |
f.savefig('Premiership.png', bbox_inches='tight') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.read_csv('premiership.csv', sep=',', encoding='utf-8', index_col=None) | |
#,names=['Ans','Details', 'Question','Answer2'] | |
#df.columns = ['Intent', 'Expected','Confidence'] | |
df.head() | |
plt.scatter(df['Pts'], df['GF'], alpha=0.4) | |
plt.title('Goals Scored Versus Points') | |
plt.xlabel('Goals Scored') | |
plt.ylabel('Points') | |
plt.text(87, 27, "corr 0.91",size=10) | |
plt.savefig('GoalsPoints.png', bbox_inches='tight') | |
import numpy as np | |
#np.corr(df['GF'], df['GA']) #df['Pts'], df['GF'] | |
df.corr() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pos | team | Pld | W | D | L | GF | GA | GD | Pts | year | |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | Manchester City (C) | 38 | 28 | 5 | 5 | 93 | 29 | 64 | 89 | 2012 | |
2 | Manchester United | 38 | 28 | 5 | 5 | 89 | 33 | 56 | 89 | 2012 | |
3 | Arsenal | 38 | 21 | 7 | 10 | 74 | 49 | 25 | 70 | 2012 | |
4 | Tottenham Hotspur | 38 | 20 | 9 | 9 | 66 | 41 | 25 | 69 | 2012 | |
5 | Newcastle United | 38 | 19 | 8 | 11 | 56 | 51 | 5 | 65 | 2012 | |
6 | Chelsea | 38 | 18 | 10 | 10 | 65 | 46 | 19 | 64 | 2012 | |
7 | Everton | 38 | 15 | 11 | 12 | 50 | 40 | 10 | 56 | 2012 | |
8 | Liverpool | 38 | 14 | 10 | 14 | 47 | 40 | 7 | 52 | 2012 | |
9 | Fulham | 38 | 14 | 10 | 14 | 48 | 51 | −3 | 52 | 2012 | |
10 | West Bromwich Albion | 38 | 13 | 8 | 17 | 45 | 52 | −7 | 47 | 2012 | |
11 | Swansea City | 38 | 12 | 11 | 15 | 44 | 51 | −7 | 47 | 2012 | |
12 | Norwich City | 38 | 12 | 11 | 15 | 52 | 66 | −14 | 47 | 2012 | |
13 | Sunderland | 38 | 11 | 12 | 15 | 45 | 46 | −1 | 45 | 2012 | |
14 | Stoke City | 38 | 11 | 12 | 15 | 36 | 53 | −17 | 45 | 2012 | |
15 | Wigan Athletic | 38 | 11 | 10 | 17 | 42 | 62 | −20 | 43 | 2012 | |
16 | Aston Villa | 38 | 7 | 17 | 14 | 37 | 53 | −16 | 38 | 2012 | |
17 | Queens Park Rangers | 38 | 10 | 7 | 21 | 43 | 66 | −23 | 37 | 2012 | |
18 | Bolton Wanderers (R) | 38 | 10 | 6 | 22 | 46 | 77 | −31 | 36 | 2012 | |
19 | Blackburn Rovers (R) | 38 | 8 | 7 | 23 | 48 | 78 | −30 | 31 | 2012 | |
20 | Wolverhampton Wanderers (R) | 38 | 5 | 10 | 23 | 40 | 82 | −42 | 25 | 2012 | |
21 | Notts County (R) | 46 | 12 | 14 | 20 | 45 | 63 | −18 | 50 | 2012 | |
22 | Crawley Town (R) | 46 | 13 | 11 | 22 | 53 | 79 | −26 | 50 | 2012 | |
23 | Leyton Orient (R) | 46 | 12 | 13 | 21 | 59 | 69 | −10 | 49 | 2012 | |
24 | Yeovil Town (R) | 46 | 10 | 10 | 26 | 36 | 75 | −39 | 40 | 2012 | |
1 | Manchester United (C) | 38 | 28 | 5 | 5 | 86 | 43 | 43 | 89 | 2013 | |
2 | Manchester City | 38 | 23 | 9 | 6 | 66 | 34 | 32 | 78 | 2013 | |
3 | Chelsea | 38 | 22 | 9 | 7 | 75 | 39 | 36 | 75 | 2013 | |
4 | Arsenal | 38 | 21 | 10 | 7 | 72 | 37 | 35 | 73 | 2013 | |
5 | Tottenham Hotspur | 38 | 21 | 9 | 8 | 66 | 46 | 20 | 72 | 2013 | |
6 | Everton | 38 | 16 | 15 | 7 | 55 | 40 | 15 | 63 | 2013 | |
7 | Liverpool | 38 | 16 | 13 | 9 | 71 | 43 | 28 | 61 | 2013 | |
8 | West Bromwich Albion | 38 | 14 | 7 | 17 | 53 | 57 | −4 | 49 | 2013 | |
9 | Swansea City | 38 | 11 | 13 | 14 | 47 | 51 | −4 | 46 | 2013 | |
10 | West Ham United | 38 | 12 | 10 | 16 | 45 | 53 | −8 | 46 | 2013 | |
11 | Norwich City | 38 | 10 | 14 | 14 | 41 | 58 | −17 | 44 | 2013 | |
12 | Fulham | 38 | 11 | 10 | 17 | 50 | 60 | −10 | 43 | 2013 | |
13 | Stoke City | 38 | 9 | 15 | 14 | 34 | 45 | −11 | 42 | 2013 | |
14 | Southampton | 38 | 9 | 14 | 15 | 49 | 60 | −11 | 41 | 2013 | |
15 | Aston Villa | 38 | 10 | 11 | 17 | 47 | 69 | −22 | 41 | 2013 | |
16 | Newcastle United | 38 | 11 | 8 | 19 | 45 | 68 | −23 | 41 | 2013 | |
17 | Sunderland | 38 | 9 | 12 | 17 | 41 | 54 | −13 | 39 | 2013 | |
18 | Wigan Athletic (R) | 38 | 9 | 9 | 20 | 47 | 73 | −26 | 36 | 2013 | |
19 | Reading (R) | 38 | 6 | 10 | 22 | 43 | 73 | −30 | 28 | 2013 | |
1 | Chelsea (C) | 38 | 26 | 9 | 3 | 73 | 32 | 41 | 87 | 2014 | |
2 | Manchester City | 38 | 24 | 7 | 7 | 83 | 38 | 45 | 79 | 2014 | |
3 | Arsenal | 38 | 22 | 9 | 7 | 71 | 36 | 35 | 75 | 2014 | |
4 | Manchester United | 38 | 20 | 10 | 8 | 62 | 37 | 25 | 70 | 2014 | |
5 | Tottenham Hotspur | 38 | 19 | 7 | 12 | 58 | 53 | 5 | 64 | 2014 | |
6 | Liverpool | 38 | 18 | 8 | 12 | 52 | 48 | 4 | 62 | 2014 | |
7 | Southampton | 38 | 18 | 6 | 14 | 54 | 33 | 21 | 60 | 2014 | |
8 | Swansea City | 38 | 16 | 8 | 14 | 46 | 49 | −3 | 56 | 2014 | |
9 | Stoke City | 38 | 15 | 9 | 14 | 48 | 45 | 3 | 54 | 2014 | |
10 | Crystal Palace | 38 | 13 | 9 | 16 | 47 | 51 | −4 | 48 | 2014 | |
11 | Everton | 38 | 12 | 11 | 15 | 48 | 50 | −2 | 47 | 2014 | |
12 | West Ham United | 38 | 12 | 11 | 15 | 44 | 47 | −3 | 47 | 2014 | |
13 | West Bromwich Albion | 38 | 11 | 11 | 16 | 38 | 51 | −13 | 44 | 2014 | |
14 | Leicester City | 38 | 11 | 8 | 19 | 46 | 55 | −9 | 41 | 2014 | |
15 | Newcastle United | 38 | 10 | 9 | 19 | 40 | 63 | −23 | 39 | 2014 | |
16 | Sunderland | 38 | 7 | 17 | 14 | 31 | 53 | −22 | 38 | 2014 | |
17 | Aston Villa | 38 | 10 | 8 | 20 | 31 | 57 | −26 | 38 | 2014 | |
18 | Hull City (R) | 38 | 8 | 11 | 19 | 33 | 51 | −18 | 35 | 2014 | |
19 | Burnley (R) | 38 | 7 | 12 | 19 | 28 | 53 | −25 | 33 | 2014 | |
20 | Queens Park Rangers (R) | 38 | 8 | 6 | 24 | 42 | 73 | −31 | 30 | 2014 | |
1 | Leicester City (C) | 38 | 23 | 12 | 3 | 68 | 36 | 32 | 81 | 2015 | |
2 | Arsenal | 38 | 20 | 11 | 7 | 65 | 36 | 29 | 71 | 2015 | |
3 | Tottenham Hotspur | 38 | 19 | 13 | 6 | 69 | 35 | 34 | 70 | 2015 | |
4 | Manchester City | 38 | 19 | 9 | 10 | 71 | 41 | 30 | 66 | 2015 | |
5 | Manchester United | 38 | 19 | 9 | 10 | 49 | 35 | 14 | 66 | 2015 | |
6 | Southampton | 38 | 18 | 9 | 11 | 59 | 41 | 18 | 63 | 2015 | |
7 | West Ham United | 38 | 16 | 14 | 8 | 65 | 51 | 14 | 62 | 2015 | |
8 | Liverpool | 38 | 16 | 12 | 10 | 63 | 50 | 13 | 60 | 2015 | |
9 | Stoke City | 38 | 14 | 9 | 15 | 41 | 55 | −14 | 51 | 2015 | |
10 | Chelsea | 38 | 12 | 14 | 12 | 59 | 53 | 6 | 50 | 2015 | |
11 | Everton | 38 | 11 | 14 | 13 | 59 | 55 | 4 | 47 | 2015 | |
12 | Swansea City | 38 | 12 | 11 | 15 | 42 | 52 | −10 | 47 | 2015 | |
13 | Watford | 38 | 12 | 9 | 17 | 40 | 50 | −10 | 45 | 2015 | |
14 | West Bromwich Albion | 38 | 10 | 13 | 15 | 34 | 48 | −14 | 43 | 2015 | |
15 | Crystal Palace | 38 | 11 | 9 | 18 | 39 | 51 | −12 | 42 | 2015 | |
16 | Bournemouth | 38 | 11 | 9 | 18 | 45 | 67 | −22 | 42 | 2015 | |
17 | Sunderland | 38 | 9 | 12 | 17 | 48 | 62 | −14 | 39 | 2015 | |
18 | Newcastle United (R) | 38 | 9 | 10 | 19 | 44 | 65 | −21 | 37 | 2015 | |
19 | Norwich City (R) | 38 | 9 | 7 | 22 | 39 | 67 | −28 | 34 | 2015 | |
20 | Aston Villa (R) | 38 | 3 | 8 | 27 | 27 | 76 | −49 | 17 | 2015 | |
1 | Chelsea (C) | 38 | 30 | 3 | 5 | 85 | 33 | 52 | 93 | 2016 | |
2 | Tottenham Hotspur | 38 | 26 | 8 | 4 | 86 | 26 | 60 | 86 | 2016 | |
3 | Manchester City | 38 | 23 | 9 | 6 | 80 | 39 | 41 | 78 | 2016 | |
4 | Liverpool | 38 | 22 | 10 | 6 | 78 | 42 | 36 | 76 | 2016 | |
5 | Arsenal | 38 | 23 | 6 | 9 | 77 | 44 | 33 | 75 | 2016 | |
6 | Manchester United | 38 | 18 | 15 | 5 | 54 | 29 | 25 | 69 | 2016 | |
7 | Everton | 38 | 17 | 10 | 11 | 62 | 44 | 18 | 61 | 2016 | |
8 | Southampton | 38 | 12 | 10 | 16 | 41 | 48 | −7 | 46 | 2016 | |
9 | Bournemouth | 38 | 12 | 10 | 16 | 55 | 67 | −12 | 46 | 2016 | |
10 | West Bromwich Albion | 38 | 12 | 9 | 17 | 43 | 51 | −8 | 45 | 2016 | |
11 | West Ham United | 38 | 12 | 9 | 17 | 47 | 64 | −17 | 45 | 2016 | |
12 | Leicester City | 38 | 12 | 8 | 18 | 48 | 63 | −15 | 44 | 2016 | |
13 | Stoke City | 38 | 11 | 11 | 16 | 41 | 56 | −15 | 44 | 2016 | |
14 | Crystal Palace | 38 | 12 | 5 | 21 | 50 | 63 | −13 | 41 | 2016 | |
15 | Swansea City | 38 | 12 | 5 | 21 | 45 | 70 | −25 | 41 | 2016 | |
16 | Burnley | 38 | 11 | 7 | 20 | 39 | 55 | −16 | 40 | 2016 | |
17 | Watford | 38 | 11 | 7 | 20 | 40 | 68 | −28 | 40 | 2016 | |
18 | Hull City (R) | 38 | 9 | 7 | 22 | 37 | 80 | −43 | 34 | 2016 | |
19 | Middlesbrough (R) | 38 | 5 | 13 | 20 | 27 | 53 | −26 | 28 | 2016 | |
20 | Sunderland (R) | 38 | 6 | 6 | 26 | 29 | 69 | −40 | 24 | 2016 | |
1 | Manchester City (C) | 38 | 32 | 4 | 2 | 106 | 27 | 79 | 100 | 2017 | |
2 | Manchester United | 38 | 25 | 6 | 7 | 68 | 28 | 40 | 81 | 2017 | |
3 | Tottenham Hotspur | 38 | 23 | 8 | 7 | 74 | 36 | 38 | 77 | 2017 | |
4 | Liverpool | 38 | 21 | 12 | 5 | 84 | 38 | 46 | 75 | 2017 | |
5 | Chelsea | 38 | 21 | 7 | 10 | 62 | 38 | 24 | 70 | 2017 | |
6 | Arsenal | 38 | 19 | 6 | 13 | 74 | 51 | 23 | 63 | 2017 | |
7 | Burnley | 38 | 14 | 12 | 12 | 36 | 39 | −3 | 54 | 2017 | |
8 | Everton | 38 | 13 | 10 | 15 | 44 | 58 | −14 | 49 | 2017 | |
9 | Leicester City | 38 | 12 | 11 | 15 | 56 | 60 | −4 | 47 | 2017 | |
10 | Newcastle United | 38 | 12 | 8 | 18 | 39 | 47 | −8 | 44 | 2017 | |
11 | Crystal Palace | 38 | 11 | 11 | 16 | 45 | 55 | −10 | 44 | 2017 | |
12 | Bournemouth | 38 | 11 | 11 | 16 | 45 | 61 | −16 | 44 | 2017 | |
13 | West Ham United | 38 | 10 | 12 | 16 | 48 | 68 | −20 | 42 | 2017 | |
14 | Watford | 38 | 11 | 8 | 19 | 44 | 64 | −20 | 41 | 2017 | |
15 | Brighton & Hove Albion | 38 | 9 | 13 | 16 | 34 | 54 | −20 | 40 | 2017 | |
16 | Huddersfield Town | 38 | 9 | 10 | 19 | 28 | 58 | −30 | 37 | 2017 | |
17 | Southampton | 38 | 7 | 15 | 16 | 37 | 56 | −19 | 36 | 2017 | |
18 | Swansea City (R) | 38 | 8 | 9 | 21 | 28 | 56 | −28 | 33 | 2017 | |
19 | Stoke City (R) | 38 | 7 | 12 | 19 | 35 | 68 | −33 | 33 | 2017 | |
20 | West Bromwich Albion (R) | 38 | 6 | 13 | 19 | 31 | 56 | −25 | 31 | 2017 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment