From 4834a04e77049496cf516feb89d2915b78a54603 Mon Sep 17 00:00:00 2001 From: Alyona Teyber Date: Fri, 16 Feb 2024 14:37:23 -0800 Subject: [PATCH] Fixing the artifacts created by XLSX files (#170) Signed-off-by: Alyona Teyber --- converters/xlsx-spida2csv-geodata.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/converters/xlsx-spida2csv-geodata.py b/converters/xlsx-spida2csv-geodata.py index 10a2c39c6..814a49b7a 100644 --- a/converters/xlsx-spida2csv-geodata.py +++ b/converters/xlsx-spida2csv-geodata.py @@ -119,10 +119,13 @@ def convert(input_files, output_file, options={}): # Read all the sheets in the .xlxs file file_extension = input_pole_file.split(".")[-1] if file_extension == 'xlsx': - df = pd.read_excel(input_pole_file, sheet_name=0, usecols=[ - 'Structure ID', 'AS-IS AGL', 'AS-IS Species', 'AS-IS GLC', 'AS-IS Length', - 'AS-IS Class', 'AS-IS Allowable Stress Adjustment', - 'AS-IS Effective Stress Adjustment', 'AS-IS GPS Point'], engine='openpyxl') + df = pd.read_excel(input_pole_file, sheet_name=0, engine='openpyxl') + df.columns = [col.replace("_x0020_", " ") for col in df.columns] + desired_columns = [ + 'Structure ID', 'AS-IS AGL', 'AS-IS Species', 'AS-IS GLC', 'AS-IS Length', + 'AS-IS Class', 'AS-IS Allowable Stress Adjustment', + 'AS-IS Effective Stress Adjustment', 'AS-IS GPS Point'] + df = df[desired_columns] elif file_extension == 'xls': df = pd.read_excel(input_pole_file, sheet_name=0, usecols=[ 'Structure ID', 'AS-IS AGL', 'AS-IS Species', 'AS-IS GLC', 'AS-IS Length',