示例#1
0
    def test_median(self):
        self.assertAlmostEqual(np.median(self.ts), self.ts.median())

        ts = self.ts.copy()
        ts[::2] = np.NaN

        self.assertAlmostEqual(np.median(ts.valid()), ts.median())

        # test with integers, test failure
        int_ts = TimeSeries(np.ones(10, dtype=int), index=range(10))
        self.assertAlmostEqual(np.median(int_ts), int_ts.median())
示例#2
0
    def test_median(self):
        self._check_stat_op('median', np.median)

        # test with integers, test failure
        int_ts = TimeSeries(np.ones(10, dtype=int), index=range(10))
        self.assertAlmostEqual(np.median(int_ts), int_ts.median())