diff --git a/statistics/customer_churn.py b/statistics/customer_churn.py index b5acc27..2d16bbd 100755 --- a/statistics/customer_churn.py +++ b/statistics/customer_churn.py @@ -113,7 +113,7 @@ def inverse_logit(model_formula): print("Probability of churn when account length changes by 1: %.2f" % (inverse_logit(cust_serv_mean) - inverse_logit(cust_serv_mean_minus_one))) # Predict churn for "new" observations -new_observations = churn.ix[churn.index.isin(xrange(10)), independent_variables.columns] +new_observations = churn.loc[churn.index.isin(range(10)), independent_variables.columns] new_observations_with_constant = sm.add_constant(new_observations, prepend=True) y_predicted = logit_model.predict(new_observations_with_constant) y_predicted_rounded = [round(score, 2) for score in y_predicted] @@ -135,4 +135,4 @@ def inverse_logit(model_formula): # Predict output value for a new observation based on its mean standardized input values input_variables = [0., 0., 0., 1.] predicted_value = logit_model.predict(input_variables) -print("Predicted value: %.5f") % predicted_value \ No newline at end of file +print("Predicted value: %.5f") % predicted_value