In [1]:
# Libraries
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot')
import random as rng
import numpy as np
%matplotlib inline
In [56]:
data = pd.read_csv("ocr_data/table_iterations/ocr_corrected.csv")
In [57]:
data.head()
Out[57]:
2015:Team
OPR Rank
2014:Team
OPR Rank.1
2013:Team
OPR Rank.2
2012:Team
OPR Rank.3
2011:Team
OPR Rank.4
2010:Team
OPR Rank.5
2009:Team
OPR Rank.6
2008:Team
OPR Rank.7
0
1
229
1
1207
1
958
1
984
1
330
1
53
1
317
1
161
1
4
1085
4
1404
4
1007
4
2099
4
1338
4
364
4
436
4
1242
2
8
1969
8
1262
8
2001
7
1861
7
1159
7
572
7
328
5
197
3
11
231
11
410
11
54
8
113
8
946
8
234
8
1041
7
1208
4
16
74
16
13
16
261
11
223
11
40
11
302
11
429
8
635
In [47]:
# make individual dataframes for each year
df_2015 = data[['2015','Unnamed: 4']]
df_2014 = data[['2014','Unnamed: 7']]
df_2013 = data[['2013','Unnamed: 4']]
df_2015.head()
Out[47]:
2015
Unnamed: 4
0
Team
OPR Rank
1
1
229
2
4
1085
3
8
1969
4
11
231
In [37]:
plt.boxplot(data["Unnamed: 3"][1:])
plt.show()
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-37-d225a414cad2> in <module>()
----> 1 plt.boxplot(data["Unnamed: 3"][1:])
2 plt.show()
/Users/dinbecevic/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in boxplot(x, notch, sym, vert, whis, positions, widths, patch_artist, bootstrap, usermedians, conf_intervals, meanline, showmeans, showcaps, showbox, showfliers, boxprops, labels, flierprops, medianprops, meanprops, capprops, whiskerprops, manage_xticks, hold, data)
2708 meanprops=meanprops, capprops=capprops,
2709 whiskerprops=whiskerprops,
-> 2710 manage_xticks=manage_xticks, data=data)
2711 finally:
2712 ax.hold(washold)
/Users/dinbecevic/anaconda/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
1809 warnings.warn(msg % (label_namer, func.__name__),
1810 RuntimeWarning, stacklevel=2)
-> 1811 return func(ax, *args, **kwargs)
1812 pre_doc = inner.__doc__
1813 if pre_doc is None:
/Users/dinbecevic/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in boxplot(self, x, notch, sym, vert, whis, positions, widths, patch_artist, bootstrap, usermedians, conf_intervals, meanline, showmeans, showcaps, showbox, showfliers, boxprops, labels, flierprops, medianprops, meanprops, capprops, whiskerprops, manage_xticks)
3206 bootstrap = rcParams['boxplot.bootstrap']
3207 bxpstats = cbook.boxplot_stats(x, whis=whis, bootstrap=bootstrap,
-> 3208 labels=labels)
3209 if notch is None:
3210 notch = rcParams['boxplot.notch']
/Users/dinbecevic/anaconda/lib/python2.7/site-packages/matplotlib/cbook.pyc in boxplot_stats(X, whis, bootstrap, labels)
1969
1970 # convert X to a list of lists
-> 1971 X = _reshape_2D(X)
1972
1973 ncols = len(X)
/Users/dinbecevic/anaconda/lib/python2.7/site-packages/matplotlib/cbook.pyc in _reshape_2D(X)
2217 # one item
2218 if len(X.shape) == 1:
-> 2219 if hasattr(X[0], 'shape'):
2220 X = list(X)
2221 else:
/Users/dinbecevic/anaconda/lib/python2.7/site-packages/pandas/core/series.pyc in __getitem__(self, key)
555 def __getitem__(self, key):
556 try:
--> 557 result = self.index.get_value(self, key)
558
559 if not np.isscalar(result):
/Users/dinbecevic/anaconda/lib/python2.7/site-packages/pandas/core/index.pyc in get_value(self, series, key)
1788
1789 try:
-> 1790 return self._engine.get_value(s, k)
1791 except KeyError as e1:
1792 if len(self) > 0 and self.inferred_type in ['integer','boolean']:
pandas/index.pyx in pandas.index.IndexEngine.get_value (pandas/index.c:3204)()
pandas/index.pyx in pandas.index.IndexEngine.get_value (pandas/index.c:2903)()
pandas/index.pyx in pandas.index.IndexEngine.get_loc (pandas/index.c:3843)()
pandas/hashtable.pyx in pandas.hashtable.Int64HashTable.get_item (pandas/hashtable.c:6525)()
pandas/hashtable.pyx in pandas.hashtable.Int64HashTable.get_item (pandas/hashtable.c:6463)()
KeyError: 0
Content source: cougarTech2228/Scouting-2016
Similar notebooks: