예제 #1
0
 def test_get_deviation__Series(self):
     result = calculator.get_deviations(pd.Series([1.2, 3, 4.8]))
     self.assertFrameEqual(result, pd.Series([-1, 0, 1]), check_dtype=False)
예제 #2
0
 def test_get_deviation__DataFrame(self):
     result = calculator.get_deviations(pd.DataFrame({'a': [1, 3, 5], 'b': [5, 3, 1]}))
     self.assertFrameEqual(result, pd.DataFrame({'a': [-1, 0, 1], 'b': [1, 0, -1]}), check_dtype=False)
예제 #3
0
def is_outlier(frame, tolerance):
    """ Tests whether each value of <frame> deviates from the mean of the column by more than <tolerance> * sigma
        frame: Series or DataFrame object
    """
    return np.abs(get_deviations(frame)) > tolerance