I am trying to fix the missing values after splitting the data into X_train,y_train,X_test,y_test and when i try to fix them i have been popped out with the following error SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame
X = df1.drop(['Id','SalePrice'],axis=1)
y = df1[['SalePrice']]
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25)
def fill_in(dataset):
for i in dataset.columns:
if dataset[i].isna and dataset[i].dtype == 'O':
# print(dataset[i])
dataset[i].fillna('missing',inplace = True)
return dataset
fill_in(X_train)