From 00268567c1076681d7383410b9ccee0b1a7d5ff9 Mon Sep 17 00:00:00 2001 From: msorvoja Date: Tue, 7 Jan 2025 13:08:30 +0200 Subject: [PATCH] Fix missing denominator column in ALR Previously, if denominator column was not in selected columns, it was removed before the transformation. --- eis_toolkit/transformations/coda/alr.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eis_toolkit/transformations/coda/alr.py b/eis_toolkit/transformations/coda/alr.py index 8e43224f..8a16d2e3 100644 --- a/eis_toolkit/transformations/coda/alr.py +++ b/eis_toolkit/transformations/coda/alr.py @@ -62,7 +62,12 @@ def alr_transform( if invalid_columns: raise InvalidColumnException(f"The following columns were not found in the dataframe: {invalid_columns}.") columns_to_transform = columns - df = df[columns_to_transform] + + if denominator_column not in columns_to_transform: + df = df[columns_to_transform + [denominator_column]] + else: + df = df[columns_to_transform] + else: columns_to_transform = df.columns.to_list()