Exemple #1
0
    def test_check_for_discontinuity__DatetimeIndex(self):
        df = pd.DataFrame({
            'a': [1, 2, 100, 101, 102],
            'b': [1, 2, 3, 4, 100],
            'c': [1, 2, 3, 4, 5],
        }, index=pd.date_range("2012-01-01", periods=5))

        result = sanity.check_for_discontinuity(df, 1)

        self.assertFrameEqual(result, pd.DataFrame({
            'a': [2, np.nan],
            'b': [np.nan, 4],
        }, index=pd.to_datetime(["2012-01-02", "2012-01-04"])))
Exemple #2
0
    def test_check_for_discontinuity(self):
        df = pd.DataFrame({
            'a': [1, 2, 100, 101, 102],
            'b': [1, 2, 3, 4, 100],
            'c': [1, 2, 3, 4, 5],
        })

        result = sanity.check_for_discontinuity(df, 1)

        self.assertFrameEqual(result, pd.DataFrame({
            'a': [2, np.nan],
            'b': [np.nan, 4],
        }, index=[1, 3]))