Beispiel #1
0
    def test_firstValid(self):
        ts = self.ts.copy()
        ts[:5] = np.NaN

        index = ts._firstTimeWithValue()
        self.assertEqual(index, ts.index[5])

        ts[-5:] = np.NaN
        index = ts._lastTimeWithValue()
        self.assertEqual(index, ts.index[-6])

        ser = Series([], index=[])
        self.assert_(ser._lastTimeWithValue() is None)
        self.assert_(ser._firstTimeWithValue() is None)
Beispiel #2
0
    def test_firstValid(self):
        ts = self.ts.copy()
        ts[:5] = np.NaN

        index = ts._firstTimeWithValue()
        self.assertEqual(index, ts.index[5])

        ts[-5:] = np.NaN
        index = ts._lastTimeWithValue()
        self.assertEqual(index, ts.index[-6])

        ser = Series([], index=[])
        self.assert_(ser._lastTimeWithValue() is None)
        self.assert_(ser._firstTimeWithValue() is None)