Skip to content

Commit 514f963

Browse files
committed
minmax: handle nans
1 parent f632f0e commit 514f963

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

analyze/dnn/utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ def encode_minmax(df, name):
7676
"""
7777
Encodes the named column in the dataframe via min max.
7878
"""
79+
# replace missing values (NaN) with a 0
80+
df[name].fillna(0,inplace=True)
7981
min_max_scaler = preprocessing.MinMaxScaler()
8082
print(colored("encode_minmax " + name, "yellow"))
8183
df[[name]] = min_max_scaler.fit_transform(df[[name]])

0 commit comments

Comments
 (0)