data = pd.Series([1, 8, 9, 10, 9])
grubbs.test(data, alpha=0.05)
KeyError Traceback (most recent call last)
<ipython-input-5-1838b39dbcff> in <module>
1 data = pd.Series([1, 8, 9, 10, 9])
----> 2 grubbs.test(data, alpha=0.05)
~\miniconda3\lib\site-packages\outliers\smirnov_grubbs.py in test(data, alpha)
241
242 def test(data, alpha=DEFAULT_ALPHA):
--> 243 return two_sided_test(data, alpha)
~\miniconda3\lib\site-packages\outliers\smirnov_grubbs.py in two_sided_test(data, alpha)
205
206 def two_sided_test(data, alpha=DEFAULT_ALPHA):
--> 207 return _two_sided_test(data, alpha, OutputType.DATA)
208
209
~\miniconda3\lib\site-packages\outliers\smirnov_grubbs.py in _two_sided_test(data, alpha, output_type)
193
194 def _two_sided_test(data, alpha, output_type):
--> 195 return _test(TwoSidedGrubbsTest, data, alpha, output_type)
196
197
~\miniconda3\lib\site-packages\outliers\smirnov_grubbs.py in _test(test_class, data, alpha, output_type)
189
190 def _test(test_class, data, alpha, output_type):
--> 191 return test_class(data).run(alpha, output_type=output_type)
192
193
~\miniconda3\lib\site-packages\outliers\smirnov_grubbs.py in run(self, alpha, output_type)
120
121 while True:
--> 122 outlier_index = self._test_once(data, alpha)
123 if outlier_index is None:
124 break
~\miniconda3\lib\site-packages\outliers\smirnov_grubbs.py in _test_once(self, data, alpha)
101 :return: the index of the outlier if one if found; None otherwise
102 """
--> 103 target_index, value = self._target(data)
104
105 g = value / data.std()
~\miniconda3\lib\site-packages\outliers\smirnov_grubbs.py in _target(self, data)
152 relative_values = abs(data - data.mean())
153 index = relative_values.argmax()
--> 154 value = relative_values[index]
155 return index, value
156
~\miniconda3\lib\site-packages\pandas\core\series.py in __getitem__(self, key)
869 key = com.apply_if_callable(key, self)
870 try:
--> 871 result = self.index.get_value(self, key)
872
873 if not is_scalar(result):
~\miniconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
4402 k = self._convert_scalar_indexer(k, kind="getitem")
4403 try:
-> 4404 return self._engine.get_value(s, k, tz=getattr(series.dtype, "tz", None))
4405 except KeyError as e1:
4406 if len(self) > 0 and (self.holds_integer() or self.is_boolean()):
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_value()
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_value()
pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
KeyError: 0