Skip to content

Commit

Permalink
Fixing the artifacts created by XLSX files (#170)
Browse files Browse the repository at this point in the history
Signed-off-by: Alyona Teyber <[email protected]>
  • Loading branch information
aivanova5 authored Feb 16, 2024
1 parent f7495b5 commit 4834a04
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions converters/xlsx-spida2csv-geodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 4834a04

Please sign in to comment.