Get startedGet started for free

Stack the calls!

New week, new project! One of your clients, a telecommunication company, wants to know why its customers are leaving. You will perform an analysis to figure it out. First, you explored the dataset churn and realized some information is missing. The dataset contains data about the total number of calls and the minutes spent on the phone by different customers. However, the state and city they live in are not listed.

You predefined an array with that data. You'd like to add it as an index in your DataFrame.

The DataFrame churn is available for you. It contains data about area code, total_day_calls and total_day_minutes. Make sure to examine it in the console!

This exercise is part of the course

Reshaping Data with pandas

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Predefined list to use as index
new_index = [['California', 'California', 'New York', 'Ohio'], 
             ['Los Angeles', 'San Francisco', 'New York', 'Cleveland']]

# Create a multi-level index using predefined new_index
churn_new = pd.____.____(____, names=[____, ____])

# Print churn_new
print(churn_new)
Edit and Run Code