Skip to content

Commit

Permalink
Strip leading and trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
olejandro committed Dec 20, 2024
1 parent bf1bae5 commit 8ec7b7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xl2times/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 8ec7b7e

Please sign in to comment.