Skip to content

Commit

Permalink
Update impute_missing_values to handle SAS table NaN values
Browse files Browse the repository at this point in the history
  • Loading branch information
djm21 committed Dec 19, 2023
1 parent 9e1e2ae commit 1c032e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sasctl/pzmm/write_score_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,10 +721,10 @@ def impute_missing_values(data):
"""
impute_values = \\\n + {"var1": 0, "var2": "", "var3": 125.3}
"""
cls.score_code += f"\n{'':4}return data.fillna(impute_values)\n"
cls.score_code += f"\n{'':4}return data.replace(' .', np.nan).fillna(impute_values).apply(pd.to_numeric, errors='ignore')\n"
"""
return data.fillna(impute_values)
return data.replace(' .', np.nan).fillna(impute_values).apply(pd.to_numeric, errors='ignore')
"""

# TODO: Needs unit test
Expand Down

0 comments on commit 1c032e2

Please sign in to comment.