Skip to content

Instantly share code, notes, and snippets.

@Perishleaf
Created December 15, 2019 21:43
Show Gist options
  • Save Perishleaf/04b97c58df2de7f8f282ca543349acf2 to your computer and use it in GitHub Desktop.
Save Perishleaf/04b97c58df2de7f8f282ca543349acf2 to your computer and use it in GitHub Desktop.
Value imputation
new_data = []
for x, y, i, k in zip(data_for_pred.House_buy, data_for_pred.House_rent, data_for_pred.Suburb, data_for_pred.Postcode):
if y != 0:
x_pred = (y - regr.intercept_[0])/regr.coef_[0][0]
new_data.append([(i, k, y, x_pred)])
else:
y_pred = regr.coef_[0][0]*x + regr.intercept_[0]
new_data.append([(i, k, y_pred, x)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment