Please help with Python Machine Learning Price Prediction

I have the following code and I don’t know why the result is “nan”…

test_df['squared_error'] = (test_df['predicted_price'] - test_df['price'])**(2)
mse = test_df['squared_error'].mean()rmse = mse ** (1/2)

Result: nan

I have the same problem here:

for feature in ['guests','beds','rooms','reviews']:
    test_df['predicted_price'] = test_df.guests.apply(predict_price,feature_column=feature)
    test_df['squared_error'] = (test_df['predicted_price'] - test_df['price'])**(2)
    mse = test_df['squared_error'].mean()
    rmse = mse ** (1/2)
    print("RMSE for the {} column: {}".format(feature,rmse))

RMSE for the guests column: nan
RMSE for the beds column: nan
RMSE for the rooms column: nan
RMSE for the reviews column: nan

My dataset is in following image

All code is:
train_df = dc_listings.copy().iloc[:2792]
test_df = dc_listings.copy().iloc[2792:]
def predict_price(new_listing_value,feature_column):
temp_df = train_df
temp_df[‘distance’] = np.abs(dc_listings[feature_column] - new_listing_value)
temp_df = temp_df.sort_values(‘distance’)
knn_5 = temp_df.price.iloc[:5]
predicted_price = knn_5.mean()
test_df[‘predicted_price’] = test_df.guests.apply(predict_price,feature_column=‘guests’)
test_df[‘squared_error’] = (test_df[‘predicted_price’] - test_df[‘price’])**(2)
mse = test_df[‘squared_error’].mean()
rmse = mse ** (1/2)

Sorry, that isn’t a ‘JupyterHub’ issue even if you are running on JupyterHub. You’ll want to seek help in a more general place, such as StackOverflow.