LoslegenKostenlos loslegen

Organizing your voicemail

You will perform one final task before moving to a new project. You will reshape the DataFrame churn again. This time, you'll reorganize a row index as a column index. After that, you will move a column index to a row index. To do this, you will first unstack the DataFrame, and then stack it.

The same churn DataFrame is available for you. It contains data about minutes, calls, and charge for different times of the day, types of calls, and exited status. Make sure to examine it in the console!

Diese Übung ist Teil des Kurses

Reshaping Data with pandas

Kurs anzeigen

Anleitung zur Übung

  • Reshape churn by unstacking the type level. Assign it to churn_type.
  • Stack the resulting DataFrame using the first column level.

Interaktive Übung

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

# Unstack churn by type level
churn_type = churn.____(____=____)

# Stack the resulting DataFrame using the first column level
churn_final = _____.____(____=____)

# Print churn_type
print(churn_final)
Code bearbeiten und ausführen