Beispiel #1
0
def check_for_missing_date(frame, tolerance):
    """ Returns a collection of dates from <frame>'s index
        where the diff with previous date is greater than a tolerance.
        frame: Pandas NDFrame object which index is datetimes
        tolerance: numpy.timedelta64 object.
    """
    dates = frame.index.to_series()
    date_change = backward_delta(dates)
    return date_change[date_change > tolerance].index
Beispiel #2
0
 def test_backward_delta__DataFrame(self):
     result = calculator.backward_delta(pd.DataFrame({'a': [3, 2, 8], 'b': [3, 2, 7]}, index=[0, 1, 4]))
     self.assertFrameEqual(result, pd.DataFrame({'a': [-1, 6], 'b': [-1, 5]}, index=[1, 4]), check_dtype=False)
Beispiel #3
0
 def test_backward_delta__Series(self):
     result = calculator.backward_delta(pd.Series([3, 2, 8], index=[0, 1, 4]))
     self.assertFrameEqual(result, pd.Series([-1, 6], index=[1, 4]), check_dtype=False)