From 35506069575d2f77a1302d392bc6275e5b352f3a Mon Sep 17 00:00:00 2001 From: JB Kurland <65054169+JustinKurland@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:37:36 -0400 Subject: [PATCH] Update pad.py --- src/pytimetk/core/pad.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pytimetk/core/pad.py b/src/pytimetk/core/pad.py index 402a00eb..a2de95a8 100644 --- a/src/pytimetk/core/pad.py +++ b/src/pytimetk/core/pad.py @@ -144,6 +144,15 @@ def pad_by_time( padded_df.sort_values(by=[date_column], inplace=True) padded_df.reset_index(drop=True, inplace=True) + + col_name = padded_df.columns[padded_df.nunique() == 1] + if not col_name.empty: + col_name = col_name[0] + else: + col_name = None + + if col_name is not None: + padded_df = padded_df.assign(**{f'{col_name}': padded_df[col_name].ffill()}) return padded_df