Coding Challenge: Importing Data

Practice importing data with scikit-learn.

Now we’ll work with a dataset containing information about a bank’s customer base, featuring the following variables:

  • customerID: The customer’s unique ID.

  • gender: The customer’s gender.

  • SeniorCitizen: The customer’s senior citizen status.

  • Partner: The customer’s relationship status.

  • Dependents: The customer’s number of dependents.

  • tenure: The length of time (in months) that the individual has been a customer.

  • Services that the customer has subscribed to:

    • PhoneService

    • MultipleLines

    • InternetService

    • OnlineSecurity

    • OnlineBackup

    • DeviceProtection

    • TechSupport

    • StreamingTV

    • StreamingMovies

  • Contract: The customer’s current contract type: “Month-to-Month,” “One Year,” “Two Year.”

  • PaperlessBilling: The customer’s preference regarding paperless billing.

  • PaymentMethod: The customer’s preferred method of bank payment: bank withdrawal, credit card, mailed check.

  • MonthlyCharges: The customer’s current total monthly charge.

  • TotalCharges: The customer’s total charges.

  • Churn: Whether or not the customer has exited or churned (our target variable).

We’ve already seen how to load a dataset using pandas, so try loading this data, from a file called data.csv, by replacing line 3 in the code below:

Get hands-on with 1400+ tech skills courses.