Skip to content

Commit

Permalink
fix: newline shenanigans
Browse files Browse the repository at this point in the history
  • Loading branch information
dshemetov committed Apr 23, 2024
1 parent 8188bf7 commit cb1b83c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions nchs_mortality/delphi_nchs_mortality/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,8 @@ def pull_nchs_mortality_data(socrata_token: str, test_file: Optional[str] = None
Expected column(s) missed, The dataset schema may
have changed. Please investigate and amend the code.
Columns needed:
{'\n'.join(type_dict.keys())}
Columns available:
{'\n'.join(df.columns)}
received={''.join(type_dict.keys())}
expected={''.join(df.columns)}
""") from exc

df = df[keep_columns + ["timestamp", "state"]].set_index("timestamp")
Expand Down
6 changes: 2 additions & 4 deletions nwss_wastewater/delphi_nwss/pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ def convert_df_type(df, type_dict, logger):
try:
df = df.astype(type_dict)
except KeyError as exc:
newline = "\n"
raise KeyError(
f"""
Expected column(s) missed, The dataset schema may
have changed. Please investigate and amend the code.
expected={newline.join(sorted(type_dict.keys()))}
received={newline.join(sorted(df.columns))}
expected={''.join(sorted(type_dict.keys()))}
received={''.join(sorted(df.columns))}
"""
) from exc
if new_columns := set(df.columns) - set(type_dict.keys()):
Expand Down

0 comments on commit cb1b83c

Please sign in to comment.