From 8ec7b7ee7e7fec508d88d2e6367edf6524793467 Mon Sep 17 00:00:00 2001 From: Olexandr Balyk Date: Fri, 20 Dec 2024 12:25:12 -0500 Subject: [PATCH] Strip leading and trailing whitespace --- xl2times/transforms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xl2times/transforms.py b/xl2times/transforms.py index 169ddf8..50eb176 100644 --- a/xl2times/transforms.py +++ b/xl2times/transforms.py @@ -1191,7 +1191,7 @@ def capitalise_table_values( tables: list[EmbeddedXlTable], model: TimesModel, ) -> list[EmbeddedXlTable]: - """Ensure that all table entries are uppercase.""" + """Ensure that all table entries are uppercase. Strip leading and trailing whitespace.""" def capitalise_table_entries(table: EmbeddedXlTable): df = table.dataframe.copy() @@ -1203,7 +1203,7 @@ def capitalise_table_entries(table: EmbeddedXlTable): # Index of rows with string entries i = df[seen_col].apply(lambda x: isinstance(x, str)) if any(i): - df.loc[i, seen_col] = df[seen_col][i].str.upper() + df.loc[i, seen_col] = df[seen_col][i].str.strip().upper() return replace(table, dataframe=df) else: return table