LoslegenKostenlos loslegen

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!

Diese Übung ist Teil des Kurses

Reshaping Data with pandas

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Set state and city as index modifying the DataFrame
churn.____([____, ____], ____=____)

# Print churn
print(churn)
Code bearbeiten und ausführen