Phone directory index
After reshaping the dataset, you sent it to your colleagues and asked them to fill in some data. Now, they sent the new churn
dataset back and you realized that its shape has changed.
Before you go on, you need to do some reshaping again. The dataset contains a multi-level index in the columns. You'd like to have some columns set as the row index. Also, this time you will only stack some levels. You believe it will help you discover some patterns in the data.
The DataFrame churn
is available for you. It contains data about state
, city
, total_day_calls
and total_day_minutes
during day
and night
time. Make sure to examine it in the console!
This exercise is part of the course
Reshaping Data with pandas
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Set state and city as index modifying the DataFrame
churn.____([____, ____], ____=____)
# Print churn
print(churn)