Last active
June 16, 2020 07:47
-
-
Save GermanCM/285b7831a324c993732f408013a9ab8e to your computer and use it in GitHub Desktop.
Example for filling nan values for an attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
not_nan_mask = np.isnan(np.array(bank_product_rec_santander_data.renta.values))==False | |
renta_values_not_nan=bank_product_rec_santander_data.renta.values[not_nan_mask] | |
sub_renta_mean = np.mean(renta_values_not_nan).round(2) | |
bank_product_rec_santander_sub_df['renta'] = bank_product_rec_santander_sub_df['renta'].fillna(value=sub_renta_mean) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment