コード例 #1
0
 def test_three_pass(self):
     sigma_thresh = 2
     ser = pd.Series([-4, -4] + [0, 1, 2] * 4 + [5])
     ser = sigma_edit_series(sigma_thresh, ser, max_iter=3)
     self.assertTrue(all_in_bounds(sigma_thresh, ser))
コード例 #2
0
 def test_nothing_removed(self):
     sigma_thresh = 10
     ser = pd.Series([1, 2, 3, 4, 5])
     ser = sigma_edit_series(sigma_thresh, ser, max_iter=1)
     self.assertEqual(list(ser), [1, 2, 3, 4, 5])
コード例 #3
0
 def test_two_pass_exceed_iter(self):
     sigma_thresh = 2
     ser = pd.Series([-4] + [0, 1, 2] * 4 + [5])
     with self.assertRaises(ValueError):
         ser = sigma_edit_series(
             sigma_thresh, ser, max_iter=1)
コード例 #4
0
    def test_empty_series(self):
        sigma_thresh = 3
        ser = pd.Series([])

        with self.assertRaises(ValueError):
            sigma_edit_series(sigma_thresh, ser)
コード例 #5
0
    def test_nan_series(self):
        sigma_thresh = 3
        ser = pd.Series([np.NaN for nn in range(10)])

        with self.assertRaises(ValueError):
            sigma_edit_series(sigma_thresh, ser)
コード例 #6
0
 def test_three_pass(self):
     sigma_thresh = 2
     ser = pd.Series([-4, -4] + [0, 1, 2] * 4 + [5])
     ser = sigma_edit_series(sigma_thresh, ser, max_iter=3)
     self.assertTrue(all_in_bounds(sigma_thresh, ser))
コード例 #7
0
 def test_two_pass_exceed_iter(self):
     sigma_thresh = 2
     ser = pd.Series([-4] + [0, 1, 2] * 4 + [5])
     with self.assertRaises(ValueError):
         ser = sigma_edit_series(sigma_thresh, ser, max_iter=1)
コード例 #8
0
 def test_nothing_removed(self):
     sigma_thresh = 10
     ser = pd.Series([1, 2, 3, 4, 5])
     ser = sigma_edit_series(sigma_thresh, ser, max_iter=1)
     self.assertEqual(list(ser), [1, 2, 3, 4, 5])
コード例 #9
0
    def test_nan_series(self):
        sigma_thresh = 3
        ser = pd.Series([np.NaN for nn in range(10)])

        with self.assertRaises(ValueError):
            sigma_edit_series(sigma_thresh, ser)
コード例 #10
0
    def test_empty_series(self):
        sigma_thresh = 3
        ser = pd.Series([])

        with self.assertRaises(ValueError):
            sigma_edit_series(sigma_thresh, ser)