It is a simple project in Kaggle, just imitating one blog, but failed. enter image description here
train_inf['Age']=train_inf.fillna(train_inf['Age'].median()) ValueError: Columns must be same length as key
just this code
I am searching for a long time on net. But no use. Please help or try to give some ideas how achieve this. Thanks in advance.
CodePudding user response:
You are close, need specify column Age
for replace missing values:
train_inf['Age']=train_inf['Age'].fillna(train_inf['Age'].median())