From 950afc3f0e172d7289804ffbdf0b025325aab374 Mon Sep 17 00:00:00 2001 From: Rabah Abdul Khalek Date: Fri, 15 Mar 2024 14:04:37 +0100 Subject: [PATCH] hot-fixing transformation in push perturbation (#1849) hot fixing transformation in push perturbation Co-authored-by: Rabah Abdul Khalek Co-authored-by: Hartorn --- giskard/functions/transformation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/giskard/functions/transformation.py b/giskard/functions/transformation.py index a5027b14ad..106eb89fb2 100644 --- a/giskard/functions/transformation.py +++ b/giskard/functions/transformation.py @@ -204,7 +204,7 @@ def mad_transformation( data = data.copy() if value_added is None: value_added = compute_mad(data[column_name]) - data[column_name] = data[column_name].apply(lambda x: x + factor * value_added) + data[column_name] = data[column_name].apply(lambda x: x + factor * value_added).astype(data[column_name].dtype) return data @@ -214,5 +214,5 @@ def add_value(data: pd.DataFrame, column_name: str, value_added: float = 0.0) -> Add the value_added to the column. """ data = data.copy() - data[column_name] = data[column_name].apply(lambda x: x + value_added) + data[column_name] = data[column_name].apply(lambda x: x + value_added).astype(data[column_name].dtype) return data