Predicting Customer Attrition Rate Using Python

@lee-rowe
Nerd For Tech
Published in
4 min readSep 2, 2021

--

Photo by Stephen Dawson on Unsplash

For this project I wanted to take a good look into many different factors of a company that may effect it’s customer attrition rate, or the amount of paying customers who fail to become repeat customers to a service or product. In this context, churn is a quantifiable rate of change that occurs over a specified amount of time, so let’s take a look into the details. In this example, I will be working with a dataset that includes the following variables.

  • ‘Gender’, ‘SeniorCitizen’, ‘Partner’, ‘Dependents’,
  • ‘Tenure’, ‘PhoneService’, ‘MultipleLines’, ‘InternetService’,
  • ‘OnlineSecurity’, ‘OnlineBackup’, ‘DeviceProtection’, ‘Attrition’
  • ‘TechSupport’, ‘StreamingTV’, ‘StreamingMovies’, ‘Contract’,
  • ‘PaperlessBilling’, ‘PaymentMethod’, ‘MonthlyCharges’, ‘TotalCharges’

First things first, before importing any data in to work with we will need multiple libraries. We will use the following.

import sklearn
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import classification_report
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import…

--

--