diff --git a/featuretools/primitives/standard/transform/cumulative/cumulative_time_since_last_false.py b/featuretools/primitives/standard/transform/cumulative/cumulative_time_since_last_false.py index be5e0cc15a..b214371dc2 100644 --- a/featuretools/primitives/standard/transform/cumulative/cumulative_time_since_last_false.py +++ b/featuretools/primitives/standard/transform/cumulative/cumulative_time_since_last_false.py @@ -51,7 +51,7 @@ def time_since_previous_false(datetime_col, bool_col): df.loc[not_false_indices, "last_false_datetime"] = np.nan df["last_false_datetime"] = df["last_false_datetime"].fillna(method="ffill") total_seconds = ( - df["datetime"] - df["last_false_datetime"] + pd.to_datetime(df["datetime"]).subtract(df["last_false_datetime"]) ).dt.total_seconds() return pd.Series(total_seconds) diff --git a/featuretools/primitives/standard/transform/cumulative/cumulative_time_since_last_true.py b/featuretools/primitives/standard/transform/cumulative/cumulative_time_since_last_true.py index b237a5357b..cf86d2eeef 100644 --- a/featuretools/primitives/standard/transform/cumulative/cumulative_time_since_last_true.py +++ b/featuretools/primitives/standard/transform/cumulative/cumulative_time_since_last_true.py @@ -46,7 +46,7 @@ def time_since_previous_true(datetime_col, bool_col): df.loc[~not_false_indices, "last_true_datetime"] = np.nan df["last_true_datetime"] = df["last_true_datetime"].fillna(method="ffill") total_seconds = ( - df["datetime"] - df["last_true_datetime"] + pd.to_datetime(df["datetime"]).subtract(df["last_true_datetime"]) ).dt.total_seconds() return pd.Series(total_seconds)