def helper_test_split(test_case, test_series: TimeSeries): seriesA, seriesB = test_series.split_after(pd.Timestamp('20130104')) test_case.assertEqual(seriesA.end_time(), pd.Timestamp('20130104')) test_case.assertEqual(seriesB.start_time(), pd.Timestamp('20130105')) seriesC, seriesD = test_series.split_before(pd.Timestamp('20130104')) test_case.assertEqual(seriesC.end_time(), pd.Timestamp('20130103')) test_case.assertEqual(seriesD.start_time(), pd.Timestamp('20130104')) test_case.assertEqual(test_series.freq_str(), seriesA.freq_str()) test_case.assertEqual(test_series.freq_str(), seriesC.freq_str())
def helper_test_drop(test_case, test_series: TimeSeries): seriesA = test_series.drop_after(pd.Timestamp('20130105')) test_case.assertEqual(seriesA.end_time(), pd.Timestamp('20130105') - test_series.freq()) test_case.assertTrue( np.all(seriesA.time_index() < pd.Timestamp('20130105'))) seriesB = test_series.drop_before(pd.Timestamp('20130105')) test_case.assertEqual(seriesB.start_time(), pd.Timestamp('20130105') + test_series.freq()) test_case.assertTrue( np.all(seriesB.time_index() > pd.Timestamp('20130105'))) test_case.assertEqual(test_series.freq_str(), seriesA.freq_str()) test_case.assertEqual(test_series.freq_str(), seriesB.freq_str())