Posted on:

12 Aug 2024

0

Difference between X_train_m.loc[:,'age'] and X_train_m['age']

Hello,


In the Notebook, for the part Mean/Median/Mode Imputation. 


there is the line :

## Mean
X_train_m.loc[:,'age'] = X_train_m['age'].fillna(np.mean(X_train_m['age']))


but I don't understand what is the difference between X_train_m.loc[:,'age']  and X_train_m['age']

thanks. 


Also the line 

 m_df.loc[:,'age'] = m_df['age'].fillna(stats.mode(m_df['age'])[0][0])


doesn't work anymore. 

0 answers ( 0 marked as helpful)

Submit an answer