Loading python_ags4/AGS4.py +2 −1 Original line number Diff line number Diff line Loading @@ -431,7 +431,8 @@ def excel_to_AGS4(input_file, output_file, format_numeric_columns=True, dictiona from pandas import read_excel # Read data from Excel file in to a dictionary of dataframes tables = read_excel(input_file, sheet_name=None, engine='openpyxl') tables = read_excel(input_file, sheet_name=None, engine='openpyxl', keep_default_na=False, na_values='') # Not all worksheets in the spreadsheet may contain valid AGS4 tables, therefore # initiate variable to keep track of worksheets to export Loading tests/test.xlsx −131 B (12.8 KiB) File changed.No diff preview for this file type. View original file View changed file tests/test_ags4.py +5 −0 Original line number Diff line number Diff line Loading @@ -216,6 +216,11 @@ def test_excel_to_AGS4(): assert 'NEWCOLUMN' not in tables['LOCA'].columns assert 'stray_data' not in tables['LOCA'].values # Check whether None values in Excel are parsed as is rather than # being converted to NaN assert tables['PROJ'].loc[2, 'PROJ_LOC'] == 'None' assert tables['PROJ'].loc[2, 'PROJ_CLNT'] == 'NA' # Call function with dictionary file AGS4.excel_to_AGS4('tests/test.xlsx', 'tests/test.out', dictionary='tests/DICT.ags') Loading Loading
python_ags4/AGS4.py +2 −1 Original line number Diff line number Diff line Loading @@ -431,7 +431,8 @@ def excel_to_AGS4(input_file, output_file, format_numeric_columns=True, dictiona from pandas import read_excel # Read data from Excel file in to a dictionary of dataframes tables = read_excel(input_file, sheet_name=None, engine='openpyxl') tables = read_excel(input_file, sheet_name=None, engine='openpyxl', keep_default_na=False, na_values='') # Not all worksheets in the spreadsheet may contain valid AGS4 tables, therefore # initiate variable to keep track of worksheets to export Loading
tests/test.xlsx −131 B (12.8 KiB) File changed.No diff preview for this file type. View original file View changed file
tests/test_ags4.py +5 −0 Original line number Diff line number Diff line Loading @@ -216,6 +216,11 @@ def test_excel_to_AGS4(): assert 'NEWCOLUMN' not in tables['LOCA'].columns assert 'stray_data' not in tables['LOCA'].values # Check whether None values in Excel are parsed as is rather than # being converted to NaN assert tables['PROJ'].loc[2, 'PROJ_LOC'] == 'None' assert tables['PROJ'].loc[2, 'PROJ_CLNT'] == 'NA' # Call function with dictionary file AGS4.excel_to_AGS4('tests/test.xlsx', 'tests/test.out', dictionary='tests/DICT.ags') Loading