From d71b36372e2f584b9c2d64a5faa572b8b35f373b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20M=C3=B6nner=C3=A5t?= Date: Thu, 27 Jun 2024 21:39:10 +0200 Subject: [PATCH] Fix Excel encoding (#12) --- SymbolsFilter.pyt | 13 +++---------- SymbolsFilter.pyt.xml | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/SymbolsFilter.pyt b/SymbolsFilter.pyt index f7b7d3c..12d6acb 100644 --- a/SymbolsFilter.pyt +++ b/SymbolsFilter.pyt @@ -201,8 +201,9 @@ def save_to_files(output_path, filtered, drop_null=True, engine=None): if drop_null: df = df[df.Count != 0] - # TODO: why? + # TODO: why do we have to convert from cp252? df["Rule"] = df["Rule"].str.encode("windows-1252").str.decode("utf-8") + df["Layer"] = df["Layer"].str.encode("windows-1252").str.decode("utf-8") with pd.ExcelWriter(output_path) as writer: if engine: @@ -419,7 +420,7 @@ class SymbolFilter: df = convert_columns(df, columns_to_convert) - # Dictionary to store counts and rows for each complex filter criterion + # Store counts and rows for each complex filter criterion results = {} for label, criteria in complex_filter_criteria: @@ -448,14 +449,6 @@ class SymbolFilter: ) results[label] = count - # Print the results - - """for label, result in results.items(): - logger.info(f"\nFilter Label: {label}") - logger.info(f"Criteria: {result['criteria']}") - logger.info(f"Count: {result['count']}") - logger.info("Matching Rows:") - logger.info(result["rows"])""" filtered[layername] = results messages.addMessage( diff --git a/SymbolsFilter.pyt.xml b/SymbolsFilter.pyt.xml index 0480e4d..3b7f859 100644 --- a/SymbolsFilter.pyt.xml +++ b/SymbolsFilter.pyt.xml @@ -1,2 +1,2 @@ -20240625103715001.0TRUE202406272111471500000005000ItemDescriptionc:\program files\arcgis\pro\Resources\Help\gpSymbolsFilterCleaning up symbols without any features in a given extentsymbolsrulesArcToolbox Toolbox20240626 +20240625103715001.0TRUE202406272135541500000005000ItemDescriptionc:\program files\arcgis\pro\Resources\Help\gpSymbolsFilterCleaning up symbols without any features in a given extentsymbolsrulesArcToolbox Toolbox20240626