From bded8db7291c50ccd8bf1a1d0a402b1c2c0750d1 Mon Sep 17 00:00:00 2001 From: Sukhil Patel Date: Wed, 14 Aug 2024 09:22:49 +0100 Subject: [PATCH] Simplify end_dts --- ocf_data_sampler/select/fill_time_periods.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ocf_data_sampler/select/fill_time_periods.py b/ocf_data_sampler/select/fill_time_periods.py index f76bff7..c1d0510 100644 --- a/ocf_data_sampler/select/fill_time_periods.py +++ b/ocf_data_sampler/select/fill_time_periods.py @@ -5,8 +5,8 @@ def fill_time_periods(time_periods: pd.DataFrame, freq: pd.Timedelta): - start_dts = time_periods["start_dt"].apply(lambda x: pd.Timestamp(x).ceil(freq)) - end_dts = time_periods['end_dt'].apply(lambda x: pd.Timestamp(x)) + start_dts = pd.to_datetime(time_periods["start_dt"].values).ceil(freq) + end_dts = pd.to_datetime(time_periods['end_dt']) date_ranges = [pd.date_range(start_dt, end_dt, freq=freq) for start_dt, end_dt in zip(start_dts, end_dts)] return pd.DatetimeIndex(np.concatenate(date_ranges))