In [2]:
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

In [3]:
df = pd.read_csv('ScoreBoardFinal.csv')
print df.head(5)


    MId Home_Team  Home_Team_Goals  Away_Team_Goals Away_Team Home_Poss  \
0  9601       CAR                1                2       CHE      36.8   
1  9602       FUL                2                2       CRY      66.1   
2  9603       HUL                0                2       EVE        43   
3  9604       LIV                2                1      NUFC      66.2   
4  9605      MCFC                2                0       WHU      68.1   

  Away_Poss Home_ShotsT Away_ShotsT Home_Shots   ...    HTP      HTR     HTAR  \
0      63.2           3           7         10   ...     14  775.406  151.256   
1      33.9           5           6         15   ...     14  793.834  182.616   
2        57           3           4         12   ...     14  792.189  216.189   
3      33.8           5           2         13   ...     14  884.043  269.651   
4      31.9           7           0         28   ...     14  912.543  155.313   

      HTMR     HTDR ATP      ATR     ATAR     ATMR     ATDR  
0  269.512  354.638  14  883.673  166.000  315.499  402.174  
1  210.218  401.000  14  790.224  144.288  287.936  358.000  
2  219.000  357.000  14  862.968  173.566  293.402  396.000  
3  220.392  394.000  14  827.956   84.175  294.260  449.521  
4  350.230  407.000  14  808.489  129.325  315.164  364.000  

[5 rows x 33 columns]

In [4]:
df_copy = df.loc[df['Home_ShotsT'] != "XX-XX-"]
print df_copy


        MId       Home_Team  Home_Team_Goals  Away_Team_Goals       Away_Team  \
0      9601             CAR                1                2             CHE   
1      9602             FUL                2                2             CRY   
2      9603             HUL                0                2             EVE   
3      9604             LIV                2                1            NUFC   
4      9605            MCFC                2                0             WHU   
5      9606             NOR                0                2             ARS   
6      9607             SOT                1                1            MUFC   
7      9608             SUN                1                3            SWAN   
8      9609             TOT                3                0             AVL   
9      9610             WBA                1                2             STK   
10     9599            MCFC                4                0             AVL   
11     9600             SUN                2                0             WBA   
12     9598            MUFC                3                1             HUL   
13     9597             CRY                3                3             LIV   
14     9596             CHE                0                0             NOR   
15     9595             ARS                1                0             WBA   
16     9589             EVE                2                3            MCFC   
17     9588             AVL                3                1             HUL   
18     9590            MUFC                0                1             SUN   
19     9591            NUFC                3                0             CAR   
20     9592             STK                4                1             FUL   
21     9593            SWAN                0                1             SOT   
22     9594             WHU                2                0             TOT   
23     9587             ARS                3                0            NUFC   
24     9584             CRY                0                2            MCFC   
25     9585             LIV                0                2             CHE   
26     9586             SUN                4                0             CAR   
27     9579            MUFC                4                0             NOR   
28     9578             FUL                2                2             HUL   
29     9581             STK                0                1             TOT   
...     ...             ...              ...              ...             ...   
1110  12144         Arsenal                0                0       Liverpool   
1111  12141         Everton                0                2        Man City   
1112  12142         Watford                0                0     Southampton   
1113  12143       West Brom                2                3         Chelsea   
1114  12135  Crystal Palace                2                1     Aston Villa   
1115  12136       Leicester                1                1           Spurs   
1116  12138         Norwich                1                1           Stoke   
1117  12139      Sunderland                1                1         Swansea   
1118  12140        West Ham                3                4     Bournemouth   
1119  12137         Man Utd                0                0       Newcastle   
1120  12134       Liverpool                1                0     Bournemouth   
1121  12133        Man City                3                0         Chelsea   
1122  12132  Crystal Palace                1                2         Arsenal   
1123  12127      Sunderland                1                3         Norwich   
1124  12128         Swansea                2                0       Newcastle   
1125  12129           Spurs                2                2           Stoke   
1126  12130         Watford                0                0       West Brom   
1127  12131        West Ham                1                2       Leicester   
1128  12126     Southampton                0                3         Everton   
1129  12125     Aston Villa                0                1         Man Utd   
1130  12124       West Brom                0                3        Man City   
1131  12123           Stoke                0                1       Liverpool   
1132  12121         Arsenal                0                2        West Ham   
1133  12122       Newcastle                2                2     Southampton   
1134  12116         Chelsea                2                2         Swansea   
1135  12115     Bournemouth                0                1     Aston Villa   
1136  12117         Everton                2                2         Watford   
1137  12118       Leicester                4                2      Sunderland   
1138  12120         Norwich                1                3  Crystal Palace   
1139  12119         Man Utd                1                0           Spurs   

     Home_Poss Away_Poss Home_ShotsT Away_ShotsT Home_Shots   ...    HTP  \
0         36.8      63.2           3           7         10   ...     14   
1         66.1      33.9           5           6         15   ...     14   
2           43        57           3           4         12   ...     14   
3         66.2      33.8           5           2         13   ...     14   
4         68.1      31.9           7           0         28   ...     14   
5         37.7      62.3           5           8         11   ...     14   
6         58.5      41.5           6           2         15   ...     14   
7         53.3      46.7           4           4         20   ...     14   
8         54.7      45.3           6           1         12   ...     14   
9           43        57           4           4         18   ...     14   
10        73.3      26.7           9           0         18   ...     14   
11        48.3      51.7           4           3         10   ...     14   
12        55.3      44.7           7           2         18   ...     14   
13        34.9      65.1           6           8         10   ...     14   
14        71.3      28.7           4           3         23   ...     14   
15        60.3      39.7           4           1         15   ...     14   
16        59.3      40.7           4           6          9   ...     13   
17        44.2      55.8           9           2         15   ...     14   
18          63        37           2           1         17   ...     14   
19        53.8      46.2           6           3         22   ...     14   
20        63.3      36.7           8           2         23   ...     14   
21        38.1      61.9           3           4         12   ...     14   
22        47.2      52.8           8           3         20   ...     13   
23        61.5      38.5           8           3         20   ...     14   
24        46.4      53.6           2           6          3   ...     14   
25          73        27           8           4         26   ...     13   
26        59.6      40.4           7           1         21   ...     14   
27        61.3      38.7          11           2         25   ...     14   
28          46        54           3           4         10   ...     14   
29        50.5      49.5           3           4         17   ...     13   
...        ...       ...         ...         ...        ...   ...     ..   
1110      65.7      34.3           5           8         19   ...     13   
1111      45.7      54.3           1           9         10   ...     14   
1112        52        48           0           4         13   ...     13   
1113      43.9      56.1           6           5         15   ...     14   
1114      49.9      50.1           6           2         16   ...     14   
1115      34.8      65.2           2           6         13   ...     14   
1116      42.6      57.4           7           1         20   ...     13   
1117      39.3      60.7           2           9         10   ...     14   
1118      45.8      54.2           4           7         10   ...     14   
1119      69.3      30.7           8           0         20   ...     14   
1120      54.9      45.1           2           2         18   ...     14   
1121      49.2      50.8           8           3         18   ...     14   
1122      40.8      59.2           4           7         11   ...     14   
1123      43.9      56.1           2           6          6   ...     13   
1124      65.8      34.2           6           2         19   ...     14   
1125      53.2      46.8           7           7         13   ...     13   
1126      63.9      36.1           5           0         16   ...     13   
1127      69.8      30.2           3           5         10   ...     14   
1128      54.4      45.6           4           4         17   ...     14   
1129      45.6      54.4           1           2          5   ...     13   
1130      30.9      69.1           2           7          9   ...     14   
1131        47        53           1           3          7   ...     14   
1132      61.8      38.2           6           4         22   ...     13   
1133      56.3      43.7           4           4          9   ...     14   
1134        52        48           3          10         11   ...     14   
1135      58.4      41.6           2           3         11   ...     14   
1136      66.6      33.4           5           5         10   ...     14   
1137        44        56           8           5         20   ...     14   
1138      62.9      37.1           6           7         17   ...     14   
1139        50        50           1           4          9   ...     14   

          HTR     HTAR     HTMR     HTDR ATP      ATR     ATAR     ATMR  \
0     775.406  151.256  269.512  354.638  14  883.673  166.000  315.499   
1     793.834  182.616  210.218  401.000  14  790.224  144.288  287.936   
2     792.189  216.189  219.000  357.000  14  862.968  173.566  293.402   
3     884.043  269.651  220.392  394.000  14  827.956   84.175  294.260   
4     912.543  155.313  350.230  407.000  14  808.489  129.325  315.164   
5     805.636   93.648  341.988  370.000  14  869.152  230.624  252.528   
6     830.718  157.239  296.034  377.445  14  883.726  251.335  229.391   
7     798.745   76.958  361.257  360.530  14  795.936  278.427  163.175   
8     841.663  148.000  291.936  401.727  13  800.032  181.180  183.000   
9     810.201  166.403  349.500  294.298  14  793.845   85.944  349.901   
10    906.219  110.639  388.580  407.000  14  801.892  120.336  221.386   
11    797.444   72.644  363.800  361.000  14  808.298  216.798  297.500   
12    834.715   66.959  437.790  329.966  14  772.178  246.092  209.586   
13    791.824   93.616  338.208  360.000  13  882.914  247.614  243.300   
14    891.689   95.498  351.191  445.000  12  810.000   55.991  313.009   
15    883.867  183.982  299.552  400.333  13  811.443  156.080  359.363   
16    846.088  252.292  153.156  440.640  14  903.264  110.368  363.070   
17    802.049  130.707  217.468  453.874  14  792.268  221.334  218.500   
18    887.480  189.502  291.978  406.000  14  799.090   72.556  365.534   
19    832.056  150.000  292.406  389.650  14  781.601  178.689  252.080   
20    801.590   58.350  379.240  364.000  14  818.762  145.049  257.853   
21    831.746  286.700  169.758  375.288  14  822.914  131.821  313.093   
22    808.687  150.015  294.672  364.000  14  860.648  123.042  298.242   
23    886.661  164.195  322.466  400.000  14  831.134   96.992  356.410   
24    795.602  145.602  290.000  360.000  14  905.322  170.390  327.932   
25    882.668  286.148  211.520  385.000  14  873.132   80.134  387.478   
26    799.134   72.000  366.134  361.000  14  797.789  151.281  299.316   
27    891.129  185.299  299.830  406.000  14  813.722   89.842  352.880   
28    824.589  142.414  232.175  450.000  14  787.558  246.584  218.089   
29    806.189   97.353  312.828  396.008  14  852.671  148.000  319.768   
...       ...      ...      ...      ...  ..      ...      ...      ...   
1110  894.722  239.502  262.220  393.000  14  861.298  219.552  254.052   
1111  830.843  238.711  287.132  305.000  14  906.203   87.200  413.003   
1112  816.780  153.000  296.780  367.000  14  827.390  144.318  235.072   
1113  810.289  103.975  348.314  358.000  14  917.821   84.601  391.224   
1114  829.644  146.500  305.144  378.000  12  817.835  147.000  294.835   
1115  823.249  155.803  364.446  303.000  14  872.848  103.406  365.442   
1116  810.336  138.056  380.280  292.000  14  844.431  181.424  215.157   
1117  831.026   74.568  444.794  311.664  12  850.688  155.688  310.000   
1118  833.532   99.825  347.000  386.707  14  801.188   75.000  363.418   
1119  884.696   85.000  383.080  416.616  14  807.551  139.313  310.238   
1120  860.054  253.804  212.550  393.700  14  799.843   75.000  355.843   
1121  905.566   87.376  402.674  415.516  14  914.956  153.306  329.874   
1122  832.398  155.770  298.628  378.000  14  910.007  248.136  245.709   
1123  827.556   78.000  398.874  350.682  14  808.468  124.388  392.080   
1124  849.980  152.524  312.456  385.000  14  820.723   52.964  359.759   
1125  877.189  141.302  331.887  404.000  14  842.169  255.144  155.825   
1126  821.389  153.000  368.389  300.000  14  812.581  158.094  296.487   
1127  839.408   87.168  332.138  420.102  14  818.820  131.364  377.692   
1128  831.578  216.000  243.578  372.000  14  830.867  237.987  287.880   
1129  825.312  175.112  274.200  376.000  14  884.663   85.000  402.663   
1130  801.811  142.208  307.603  352.000  14  899.801   82.400  402.743   
1131  837.468  228.601  141.025  467.842  13  859.963  230.906  243.057   
1132  906.272  255.000  318.272  333.000  14  841.047   98.400  298.928   
1133  835.653   84.433  370.220  381.000  13  830.722  176.850  285.872   
1134  919.841  139.694  321.023  459.124  14  850.334  155.756  309.578   
1135  797.896  104.592  331.304  362.000  14  824.702  148.968  290.025   
1136  836.840  185.936  355.480  295.424  14  820.402   89.706  329.616   
1137  820.310  147.969  358.397  313.944  13  799.464   78.000  406.841   
1138  805.756  146.600  367.156  292.000  14  830.889  147.089  305.800   
1139  886.553   85.000  405.153  396.400  14  872.555  176.088  297.467   

         ATDR  
0     402.174  
1     358.000  
2     396.000  
3     449.521  
4     364.000  
5     386.000  
6     403.000  
7     354.334  
8     435.852  
9     358.000  
10    460.170  
11    294.000  
12    316.500  
13    392.000  
14    441.000  
15    296.000  
16    429.826  
17    352.434  
18    361.000  
19    350.832  
20    415.860  
21    378.000  
22    439.364  
23    377.732  
24    407.000  
25    405.520  
26    347.192  
27    371.000  
28    322.885  
29    384.903  
...       ...  
1110  387.694  
1111  406.000  
1112  448.000  
1113  441.996  
1114  376.000  
1115  404.000  
1116  447.850  
1117  385.000  
1118  362.770  
1119  358.000  
1120  369.000  
1121  431.776  
1122  416.162  
1123  292.000  
1124  408.000  
1125  431.200  
1126  358.000  
1127  309.764  
1128  305.000  
1129  397.000  
1130  414.658  
1131  386.000  
1132  443.719  
1133  368.000  
1134  385.000  
1135  385.709  
1136  401.080  
1137  314.623  
1138  378.000  
1139  399.000  

[1136 rows x 33 columns]

In [5]:
#plt.figure(figsize=(10,10))

df_poss = df_copy[(df_copy['Home_Team']=="MUFC") | (df_copy["Home_Team"] == "Man Utd")]
#print df_poss
df_poss = df_poss[['MId','Home_Team_Goals','Away_Team','Home_Shots','Home_ShotsT','HTR','HTAR','HTMR','HTDR','ATR','ATAR','ATMR','ATDR']]
df_poss['index'] = range(1, len(df_poss) + 1)
df_poss[['MId','Home_Team_Goals','Home_Shots','Home_ShotsT','HTR','HTAR','HTMR','HTDR','ATR','ATAR','ATMR','ATDR']] = df_poss[['MId','Home_Team_Goals','Home_Shots','Home_ShotsT','HTR','HTAR','HTMR','HTDR','ATR','ATAR','ATMR','ATDR']].astype(float)
print df_poss


          MId  Home_Team_Goals       Away_Team  Home_Shots  Home_ShotsT  \
12     9598.0              3.0             HUL        18.0          7.0   
18     9590.0              0.0             SUN        17.0          2.0   
27     9579.0              4.0             NOR        25.0         11.0   
73     9539.0              4.0             AVL         9.0          6.0   
77     9533.0              0.0            MCFC        10.0          4.0   
130    9479.0              2.0             FUL        31.0          9.0   
156    9453.0              2.0             CAR        17.0          5.0   
173    9435.0              2.0            SWAN        16.0          5.0   
180    9425.0              1.0             TOT        17.0          6.0   
215    9394.0              3.0             WHU        21.0          8.0   
239    9373.0              0.0            NUFC         8.0          4.0   
244    9365.0              0.0             EVE        18.0          6.0   
270    9337.0              1.0             ARS         5.0          2.0   
297    9314.0              3.0             STK        19.0          5.0   
306    9304.0              1.0             SOT        12.0          5.0   
327    9284.0              1.0             WBA        14.0          6.0   
349    9265.0              2.0             CRY        20.0          8.0   
359    9251.0              0.0             CHE        12.0          3.0   
392    9977.0              1.0         Arsenal        12.0          4.0   
414    9953.0              0.0       West Brom        26.0          9.0   
441    9928.0              4.0        Man City        11.0          7.0   
457    9914.0              3.0     Aston Villa        20.0          7.0   
473    9898.0              3.0           Spurs        11.0          3.0   
495    9872.0              2.0      Sunderland        30.0         10.0   
513    9857.0              3.0         Burnley        11.0          7.0   
535    9835.0              3.0       Leicester        12.0          5.0   
550    9820.0              0.0     Southampton        10.0          0.0   
585    9787.0              3.0       Newcastle         9.0          4.0   
602    9768.0              3.0       Liverpool        11.0          6.0   
628    9744.0              2.0           Stoke        10.0          3.0   
635    9733.0              3.0            Hull        15.0          7.0   
656    9713.0              1.0  Crystal Palace        23.0          5.0   
671    9698.0              1.0         Chelsea        19.0          7.0   
693    9678.0              2.0         Everton        15.0          4.0   
706    9666.0              2.0        West Ham         8.0          3.0   
721    9649.0              4.0             QPR        18.0          9.0   
759    9613.0              1.0         Swansea        14.0          5.0   
760   12494.0              3.0     Bournemouth        12.0          5.0   
786   12467.0              1.0       Leicester        21.0          6.0   
803   12451.0              2.0  Crystal Palace        16.0         10.0   
812   12441.0              1.0     Aston Villa        13.0          4.0   
827   12427.0              1.0         Everton        10.0          2.0   
863   12390.0              1.0         Watford        14.0          3.0   
872   12381.0              3.0         Arsenal         7.0          5.0   
903   12348.0              3.0           Stoke        15.0          5.0   
915   12337.0              0.0     Southampton         8.0          1.0   
945   12307.0              2.0         Swansea        19.0          6.0   
953   12298.0              0.0         Chelsea        12.0          2.0   
976   12277.0              1.0         Norwich        11.0          2.0   
994   12257.0              0.0        West Ham        21.0          1.0   
1025  12227.0              2.0       West Brom        13.0          3.0   
1042  12213.0              0.0        Man City         6.0          1.0   
1075  12177.0              3.0      Sunderland        12.0          7.0   
1093  12158.0              3.0       Liverpool         9.0          3.0   
1119  12137.0              0.0       Newcastle        20.0          8.0   
1139  12119.0              1.0           Spurs         9.0          1.0   

          HTR     HTAR     HTMR     HTDR      ATR     ATAR     ATMR     ATDR  \
12    834.715   66.959  437.790  329.966  772.178  246.092  209.586  316.500   
18    887.480  189.502  291.978  406.000  799.090   72.556  365.534  361.000   
27    891.129  185.299  299.830  406.000  813.722   89.842  352.880  371.000   
73    884.713  173.165  353.048  358.500  811.922  211.597  221.483  378.842   
77    888.343  252.576  237.767  398.000  912.312   83.000  420.312  409.000   
130   899.009  282.106  233.844  383.059  805.947  155.214  209.733  441.000   
156   875.515  170.528  179.702  525.285  787.235  143.000  292.468  351.767   
173   868.322   78.176  390.000  400.146  826.100  225.100  164.553  436.447   
180   878.589  191.404  308.657  378.528  854.106  141.902  323.204  389.000   
215   869.221  166.600  229.398  473.223  790.189   90.717  254.816  444.656   
239   879.087  171.000  221.954  486.133  846.124   89.310  303.835  452.979   
244   872.332  165.400  268.344  438.588  857.148  157.592  317.556  382.000   
270   891.868  171.016  272.707  448.145  888.989  175.975  314.014  399.000   
297   889.528  196.008  308.376  385.144  813.208  144.325  257.507  411.376   
306   884.364  185.297  283.414  415.653  833.542  107.728  273.814  452.000   
327   872.152  171.492  258.520  442.140  797.380  204.768  240.368  352.244   
349   892.275  175.146  345.344  371.785  780.351  142.071  237.736  400.544   
359   892.737  243.626  234.466  414.645  908.503  111.306  328.967  468.230   
392   881.498  170.678  393.000  317.820  881.469  234.935  274.134  372.400   
414   877.475  287.262  369.300  220.913  813.398   73.222  372.406  367.770   
441   885.869  177.708  465.994  242.167  903.084  174.000  323.584  405.500   
457   888.850  202.254  443.596  243.000  823.534  216.488  212.684  394.362   
473   881.859  173.964  463.387  244.508  853.847  169.516  293.331  391.000   
495   886.760  193.472  372.288  321.000  810.596  138.608  285.300  386.688   
513   874.440  338.440  154.000  382.000  783.715  147.839  278.876  357.000   
535   886.644  331.280  222.480  332.884  780.756  157.675  267.081  356.000   
550   889.578  296.630  278.838  314.110  838.100  151.000  308.168  378.932   
585   874.441  336.440  226.565  311.436  799.988  207.903  244.700  347.385   
602   880.556  308.074  330.669  241.813  844.178  305.000  233.756  305.422   
628   875.265  238.660  393.605  243.000  825.482  367.629    6.853  451.000   
635   892.090  269.482  379.608  243.000  796.387  116.381  315.006  365.000   
656   867.805  277.491  368.314  222.000  806.803  151.500  286.500  368.803   
671   875.136  250.136  231.000  394.000  919.180  147.496  357.968  413.716   
693   870.744  337.220  158.634  374.890  846.914  156.000  285.170  405.744   
706   874.513  318.092  178.750  377.671  807.161  258.387  182.496  366.278   
721   883.390  333.691  185.155  364.544  813.732   50.512  395.720  367.500   
759   867.255  214.000  325.963  327.292  830.525  158.424  297.512  374.589   
760   862.953  145.582  326.371  391.000  794.428   92.956  342.472  359.000   
786   871.568  147.859  321.709  402.000  825.574  129.544  254.966  441.064   
803   880.904  122.754  353.150  405.000  826.764   77.165  379.599  370.000   
812   877.826  121.476  354.350  402.000  817.000   82.497  224.000  510.503   
827   870.000   69.000  432.356  368.644  870.901  161.901  314.000  395.000   
863   849.792   69.000  467.367  313.425  829.191  153.167  297.024  379.000   
872   858.955   61.341  514.999  282.615  898.188  185.438  307.750  405.000   
903   877.147   86.518  393.629  397.000  840.000  305.335  155.000  379.665   
915   875.856   85.000  400.800  390.056  838.086  152.878  230.208  455.000   
945   902.050   85.000  478.373  338.677  847.823   85.853  374.970  387.000   
953   899.416   85.000  487.424  326.992  907.504  100.204  396.300  411.000   
976   891.999   85.000  477.999  329.000  804.911  129.153  313.758  362.000   
994   878.344    0.000  479.844  398.500  845.769   77.000  381.185  387.584   
1025  891.239   77.435  463.640  350.164  814.880  170.400  289.288  355.192   
1042  894.639   85.000  406.039  403.600  899.057   79.454  397.371  422.232   
1075  893.398   85.000  403.220  405.178  814.722   56.794  353.428  404.500   
1093  893.010    0.000  485.010  408.000  854.876  215.204  251.131  388.541   
1119  884.696   85.000  383.080  416.616  807.551  139.313  310.238  358.000   
1139  886.553   85.000  405.153  396.400  872.555  176.088  297.467  399.000   

      index  
12        1  
18        2  
27        3  
73        4  
77        5  
130       6  
156       7  
173       8  
180       9  
215      10  
239      11  
244      12  
270      13  
297      14  
306      15  
327      16  
349      17  
359      18  
392      19  
414      20  
441      21  
457      22  
473      23  
495      24  
513      25  
535      26  
550      27  
585      28  
602      29  
628      30  
635      31  
656      32  
671      33  
693      34  
706      35  
721      36  
759      37  
760      38  
786      39  
803      40  
812      41  
827      42  
863      43  
872      44  
903      45  
915      46  
945      47  
953      48  
976      49  
994      50  
1025     51  
1042     52  
1075     53  
1093     54  
1119     55  
1139     56  

In [6]:
plt.figure()
df_poss.set_index('Away_Team').plot(kind='bar',y='Home_Team_Goals',figsize=(18,10))
plt.show()


<matplotlib.figure.Figure at 0x9321b38>

In [7]:
df_zero_goals = df_poss[(df_poss["Home_Team_Goals"]== 0.0)]
print df_zero_goals
fig = plt.figure(figsize=(18,10))
ax = fig.add_subplot(111) # Create matplotlib axes
ax2 = ax.twinx()
width = 0.4

#f.amount.plot(kind='bar', color='red', ax=ax, width=width, position=1)
#f.price.plot(kind='bar', color='blue', ax=ax2, width=width, position=0)

df_zero_goals.ATDR.plot(kind='bar', color='red', ax=ax, width=width, position=1)
df_zero_goals.HTAR.plot(kind='bar', color='blue', ax=ax2, width=width, position=0)
plt.show()
#f_zero_goals.set_index('Away_Team').plot(kind='bar',y='ATDR',figsize=(18,10))
#lt.show()


          MId  Home_Team_Goals    Away_Team  Home_Shots  Home_ShotsT      HTR  \
18     9590.0              0.0          SUN        17.0          2.0  887.480   
77     9533.0              0.0         MCFC        10.0          4.0  888.343   
239    9373.0              0.0         NUFC         8.0          4.0  879.087   
244    9365.0              0.0          EVE        18.0          6.0  872.332   
359    9251.0              0.0          CHE        12.0          3.0  892.737   
414    9953.0              0.0    West Brom        26.0          9.0  877.475   
550    9820.0              0.0  Southampton        10.0          0.0  889.578   
915   12337.0              0.0  Southampton         8.0          1.0  875.856   
953   12298.0              0.0      Chelsea        12.0          2.0  899.416   
994   12257.0              0.0     West Ham        21.0          1.0  878.344   
1042  12213.0              0.0     Man City         6.0          1.0  894.639   
1119  12137.0              0.0    Newcastle        20.0          8.0  884.696   

         HTAR     HTMR     HTDR      ATR     ATAR     ATMR     ATDR  index  
18    189.502  291.978  406.000  799.090   72.556  365.534  361.000      2  
77    252.576  237.767  398.000  912.312   83.000  420.312  409.000      5  
239   171.000  221.954  486.133  846.124   89.310  303.835  452.979     11  
244   165.400  268.344  438.588  857.148  157.592  317.556  382.000     12  
359   243.626  234.466  414.645  908.503  111.306  328.967  468.230     18  
414   287.262  369.300  220.913  813.398   73.222  372.406  367.770     20  
550   296.630  278.838  314.110  838.100  151.000  308.168  378.932     27  
915    85.000  400.800  390.056  838.086  152.878  230.208  455.000     46  
953    85.000  487.424  326.992  907.504  100.204  396.300  411.000     48  
994     0.000  479.844  398.500  845.769   77.000  381.185  387.584     50  
1042   85.000  406.039  403.600  899.057   79.454  397.371  422.232     52  
1119   85.000  383.080  416.616  807.551  139.313  310.238  358.000     55  

In [40]:
df_goals = pd.DataFrame()
df_goals = df_copy[(df_copy["Home_Team"]=="MCFC")|(df_copy["Home_Team"]=="Man City")]
#df_copy[(df_copy['Home_Team']=="MCFC") | (df_copy["Home_Team"] == "Man City")] 
#print df_goals
#print df_goals[['Home_Shots','Home_ShotsT']]
plt.figure()
df_goals.plot(kind='scatter',x='Home_Shots',y='Home_Team_Goals',figsize=(14,10)) 
#print df_zero_goals[['Home_Shots','Home_ShotsT']] 
#df_goals.Home_Shots.plot(kind='bar', color='red', ax=ax, width=width, position=1)
#df_goals.Home_ShotsT.plot(kind='bar', color='blue', ax=ax2, width=width, position=0)
#plt.show()


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-40-5832b032c758> in <module>()
      5 #print df_goals[['Home_Shots','Home_ShotsT']]
      6 plt.figure()
----> 7 df_goals.plot(kind='scatter',x='Home_Shots',y='Home_Team_Goals',figsize=(14,10))
      8 #print df_zero_goals[['Home_Shots','Home_ShotsT']]
      9 #df_goals.Home_Shots.plot(kind='bar', color='red', ax=ax, width=width, position=1)

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\plotting\_core.py in __call__(self, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
   2618                           fontsize=fontsize, colormap=colormap, table=table,
   2619                           yerr=yerr, xerr=xerr, secondary_y=secondary_y,
-> 2620                           sort_columns=sort_columns, **kwds)
   2621     __call__.__doc__ = plot_frame.__doc__
   2622 

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\plotting\_core.py in plot_frame(data, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
   1855                  yerr=yerr, xerr=xerr,
   1856                  secondary_y=secondary_y, sort_columns=sort_columns,
-> 1857                  **kwds)
   1858 
   1859 

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\plotting\_core.py in _plot(data, x, y, subplots, ax, kind, **kwds)
   1680         plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, **kwds)
   1681 
-> 1682     plot_obj.generate()
   1683     plot_obj.draw()
   1684     return plot_obj.result

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\plotting\_core.py in generate(self)
    236         self._compute_plot_data()
    237         self._setup_subplots()
--> 238         self._make_plot()
    239         self._add_table()
    240         self._make_legend()

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\plotting\_core.py in _make_plot(self)
    829         else:
    830             label = None
--> 831         scatter = ax.scatter(data[x].values, data[y].values, c=c_values,
    832                              label=label, cmap=cmap, **self.kwds)
    833         if cb:

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
   2060             return self._getitem_multilevel(key)
   2061         else:
-> 2062             return self._getitem_column(key)
   2063 
   2064     def _getitem_column(self, key):

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\core\frame.py in _getitem_column(self, key)
   2067         # get column
   2068         if self.columns.is_unique:
-> 2069             return self._get_item_cache(key)
   2070 
   2071         # duplicate columns & possible reduce dimensionality

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\core\generic.py in _get_item_cache(self, item)
   1532         res = cache.get(item)
   1533         if res is None:
-> 1534             values = self._data.get(item)
   1535             res = self._box_item_values(item, values)
   1536             cache[item] = res

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\core\internals.py in get(self, item, fastpath)
   3588 
   3589             if not isnull(item):
-> 3590                 loc = self.items.get_loc(item)
   3591             else:
   3592                 indexer = np.arange(len(self.items))[isnull(self.items)]

C:\Users\I336006\AppData\Local\Continuum\Anaconda2\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
   2393                 return self._engine.get_loc(key)
   2394             except KeyError:
-> 2395                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   2396 
   2397         indexer = self.get_indexer([key], method=method, tolerance=tolerance)

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc (pandas\_libs\index.c:5239)()

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc (pandas\_libs\index.c:5085)()

pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas\_libs\hashtable.c:20405)()

pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas\_libs\hashtable.c:20359)()

KeyError: 'Home_Shots'
<matplotlib.figure.Figure at 0xe3d9a58>

In [ ]:
print "test"