CommencerCommencer gratuitement

Decrypting the code

You are doing a great job on the book project! Your boss encouraged you to do an analysis using books written by Dan Brown.

You explored the dataset books_brown and it needs reshaping. Again, you identified several columns to use as unique IDs and realized something different about the columns to group. Their name starts with a prefix, but this time, you identified a suffix and a separation element.

The books_brown dataset is available for you. It contains the title, author, and data about language_code, language_name, publisher_code, and publisher_name of each book. Make sure to examine it in the console!

Cet exercice fait partie du cours

Reshaping Data with pandas

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Reshape using author and title as index, code as new name and getting the prefix language and publisher
the_code_long = pd.wide_to_long(____, 
                                ____=____, 
                                ____=____, 
                                ____=____)

# Print the_code_long
print(the_code_long)
Modifier et exécuter le code