From e2356ffea7dceb2ec4c044989129b378299eda5d Mon Sep 17 00:00:00 2001 From: bowguy Date: Wed, 7 Aug 2024 10:48:28 -0600 Subject: [PATCH 1/2] Update dataframes.py change delim_whitespace=True to sep='\s+' --- swmmio/utils/dataframes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swmmio/utils/dataframes.py b/swmmio/utils/dataframes.py index fa32b09..95507fb 100644 --- a/swmmio/utils/dataframes.py +++ b/swmmio/utils/dataframes.py @@ -104,7 +104,7 @@ def dataframe_from_rpt(rpt_path, section, element_id=None): # extract the string and read into a dataframe s = extract_section_of_file(rpt_path, start_strings, end_strings) - df = pd.read_csv(StringIO(s), header=None, delim_whitespace=True, skiprows=[0], + df = pd.read_csv(StringIO(s), header=None, sep='\s+', skiprows=[0], index_col=0, names=cols) # confirm index name is string @@ -164,7 +164,7 @@ def dataframe_from_inp(inp_path, section, additional_cols=None, quote_replace=' return pd.read_csv(StringIO(s), delim_whitespace=False) else: try: - df = pd.read_csv(StringIO(s), header=None, delim_whitespace=True, + df = pd.read_csv(StringIO(s), header=None, sep='\s+', skiprows=[0], index_col=0, names=cols) except: raise IndexError(f'failed to parse {section} with cols: {cols}. head:\n{s[:500]}') From 4120f253a974f6f1b8d28b2092703efda3f3bc34 Mon Sep 17 00:00:00 2001 From: bowguy Date: Wed, 7 Aug 2024 10:52:19 -0600 Subject: [PATCH 2/2] Update text.py Change delim_whitespace=True to sep='\s+' --- swmmio/utils/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmmio/utils/text.py b/swmmio/utils/text.py index d64bd2d..7c97dda 100644 --- a/swmmio/utils/text.py +++ b/swmmio/utils/text.py @@ -263,7 +263,7 @@ def get_inp_sections_details(inp_path, include_brackets=False): ops_cols = INP_OBJECTS['OPTIONS']['columns'] ops_string = extract_section_of_file(inp_path, '[OPTIONS]', INP_SECTION_TAGS, ) options = pd.read_csv(StringIO(ops_string), header=None, - delim_whitespace=True, skiprows=[0], index_col=0, + sep='\s+', skiprows=[0], index_col=0, names=ops_cols) if 'INFILTRATION' in found_sects: