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