11. Machine Learning
Activity 25: Using Machine Learning to Predict Customer Return Rate Accuracy
Solution:
- The first step asks you to download the dataset and display the first five rows.
Import the necessary
pandas
andnumpy
libraries to begin with:import pandas as pd import numpy as np
- Next, load the
CHURN.csv
file:df = pd.read_csv('CHURN.csv')
- Now, display the headers using
.head()
:df.head()
You should get the following output:
- The next step asks you to check for
NaN
values. The following code reveals that there are none:df.info()
You should get the following output:
- The next step is done for you. The following code converts
'No'
and'Yes'
into0
and1
:df['Churn'] = df['Churn'].replace(to_replace=['No', 'Yes'], value=[0, 1])
- The next step asks you to correctly define
X
andy
. The correct solution...