예제 #1
0
 def test_time_stamp_end_date_exclusive_by_undershooting(self):
     start_time = datetime.strptime('2010/04/01 00:00:00',
                                    '%Y/%m/%d %H:%M:%S')
     end_time = datetime.strptime('2010/12/31 23:59:00',
                                  '%Y/%m/%d %H:%M:%S')
     result = filters.filter_on_timestamp(self.time_stamp_data, start_time=start_time, end_time=end_time)\
         .reset_index(drop=True)
     aim = pd.DataFrame({'TIMESTAMP': []})
     aim['TIMESTAMP'] = pd.to_datetime(aim['TIMESTAMP'],
                                       format='%Y/%m/%d %H:%M:%S')
     assert_frame_equal(aim, result)
예제 #2
0
 def test_time_stamp_pick_none_of_two_by_overshooting_date(self):
     start_time = datetime.strptime('2018/04/01 00:00:00',
                                    '%Y/%m/%d %H:%M:%S')
     end_time = datetime.strptime('2019/05/01 00:13:00',
                                  '%Y/%m/%d %H:%M:%S')
     result = filters.filter_on_timestamp(self.time_stamp_data, start_time=start_time, end_time=end_time)\
         .reset_index(drop=True)
     aim = pd.DataFrame({'TIMESTAMP': []})
     aim['TIMESTAMP'] = pd.to_datetime(aim['TIMESTAMP'],
                                       format='%Y/%m/%d %H:%M:%S')
     assert_frame_equal(aim, result)
예제 #3
0
 def test_time_stamp_pick_two_of_two_by_overlaping_interval(self):
     start_time = datetime.strptime('2010/12/31 23:59:00',
                                    '%Y/%m/%d %H:%M:%S')
     end_time = datetime.strptime('2015/05/01 00:00:00',
                                  '%Y/%m/%d %H:%M:%S')
     aim = pd.DataFrame(
         {'TIMESTAMP': ['2011/01/01 00:00:00', '2015/01/01 00:00:00']})
     result = filters.filter_on_timestamp(self.time_stamp_data, start_time=start_time, end_time=end_time)\
         .reset_index(drop=True)
     aim['TIMESTAMP'] = pd.to_datetime(aim['TIMESTAMP'],
                                       format='%Y/%m/%d %H:%M:%S')
     assert_frame_equal(aim, result)
예제 #4
0
 def test_time_stamp_pick_first_of_two(self):
     start_time = datetime.strptime('2010/06/01 00:00:00',
                                    '%Y/%m/%d %H:%M:%S')
     end_time = datetime.strptime('2011/09/01 00:13:00',
                                  '%Y/%m/%d %H:%M:%S')
     result = filters.filter_on_timestamp(self.time_stamp_data,
                                          start_time=start_time,
                                          end_time=end_time)
     aim = pd.DataFrame({'TIMESTAMP': ['2011/01/01 00:00:00']})
     aim['TIMESTAMP'] = pd.to_datetime(aim['TIMESTAMP'],
                                       format='%Y/%m/%d %H:%M:%S')
     assert_frame_equal(aim, result)