Skip to content

Commit a933c4d

Browse files
committed
added nan verification post imputation
1 parent a023689 commit a933c4d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ml_grid/util/impute_data_for_pipe.py

+10
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,17 @@ def mean_impute_dataframe(data, y_vars, test_size=0.25, val_size=0.25, random_st
7474
# Combine features and target
7575
final_data = pd.concat([X_final, y_final], axis=1)
7676

77+
# Verification step: Check for NaN values post-imputation
78+
if final_data.isnull().sum().any():
79+
print("Warning: There are still NaN values after imputation!")
80+
# Optionally, print which columns still have NaNs
81+
print(final_data.isnull().sum()[final_data.isnull().sum() > 0])
82+
else:
83+
print("No NaN values found after imputation.")
84+
7785
print(f"Final data shape: {final_data.shape}")
86+
87+
7888
return final_data
7989

8090
#df_merged = mean_impute_dataframe(df_merged, y_vars=outcome_columns, test_size=0.25, val_size=0.25, random_state=1, seed=1)

0 commit comments

Comments
 (0)