Learn practical skills, build real-world projects, and advance your career

Telecom Churn: Logistic Regression with PCA

With 21 predictor variables, we need to predict whether a particular customer will switch to another telecom provider or not. In telecom terminology, customer attrition is referred to as 'churn'.

Line 11 - telecom['TotalCharges']=telecom['TotalCharges'].convert_objects(convert_numeric=True)
Please change it to :

      -  telecom['TotalCharges']=pd.to_numeric(telecom['TotalCharges'],errors='coerce')

Line 37
- y_pred_final = y_pred_final.reindex_axis(['CustID','Churn','Churn_Prob'], axis=1)

            Please change it to:

      - y_pred_final = y_pred_final.reindex(['CustID','Churn','Churn_Prob'], axis=1)

Importing and Merging Data

# Importing Pandas and NumPy
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Importing all datasets
churn_data = pd.read_csv("churn_data.csv")
customer_data = pd.read_csv("customer_data.csv")
internet_data = pd.read_csv("internet_data.csv")