X[‘Waterfront View’] = X[‘Waterfront View’].map({‘Yes’:1, ‘No’:0})
X[‘Ever Renovated’] = X[‘Ever Renovated’].map({‘Yes’:1, ‘No’:0})
X[‘Condition of the House’] = X[‘Condition of the House’].map({‘Excellent’:5, ‘Good’:4, ‘Okay’:3, ‘Fair’:2, ‘Bad’:1})
X.head()
here’s the code, on running , the values of variable’Condition of the house’ is updated correctly, but the values of ‘ever renovated’ and ‘waterfront view’ are updated to NaN which makes it problematic while fitting in linear regression as it does not accept string or NaN values
i tried deleting the segments of code, importing the dataset again and applying the respective mapping on all the 3 variables again. But this time, none of the 3 variables are updated correctly. Now all the 3 variables ‘Waterfront view’, ‘condition of the house’ and ‘ever renovated’ display NaN in their respective columns. Due to this i am not able to apply linear regression on the dataset.
The missing values have already been handled.
Shivanshu Mishra is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.