From 83209dc798c5d9d7173368c582b50a56e9e70997 Mon Sep 17 00:00:00 2001 From: Barbara Krautgartner Date: Thu, 14 Mar 2024 08:16:53 +0000 Subject: [PATCH] fix: clean whole dataframe --- apis_ontology/scripts/import_vorlass_data.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apis_ontology/scripts/import_vorlass_data.py b/apis_ontology/scripts/import_vorlass_data.py index cbb15fc..fdbdf21 100644 --- a/apis_ontology/scripts/import_vorlass_data.py +++ b/apis_ontology/scripts/import_vorlass_data.py @@ -36,7 +36,10 @@ def parse_sigle_excel(file): df_filtered = df[(df["Werktyp"].notnull()) | (df["status"].notnull())].replace( {np.nan: None} ) - for index, row in df_filtered.iterrows(): + + df_cleaned = df_filtered.map(lambda x: x.strip() if isinstance(x, str) else x) + + for index, row in df_cleaned.iterrows(): title_siglum_dict[row["Name"] + row["abgeleitet von"]] = row.to_dict() parse_vorlass_xml(title_siglum_dict) return success, failure