Aan de slagGa gratis aan de slag

How is Frankenstein, Dorian Gray?

You are satisfied with the way you reshaped the books_gothic DataFrame, however, you would like to finish your work by naming the newly-created columns. This will help you clarify what the variables and values are.

You remember that .melt() allows you to do that. In order to achieve your goal, you will reshape your DataFrame in three steps.

The same books_gothic dataset you used before is available for you. It contains data about the title, author, number_pages, rating, rating_count, and publisher of each book. Make sure to examine it in the console!

Deze oefening maakt deel uit van de cursus

Reshaping Data with pandas

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Melt the rating and rating_count using title, authors and publisher as identifiers
books_ratings = books_gothic.____(____=____, 
                                  ____=____)

# Print books_ratings
print(books_ratings)
Code bewerken en uitvoeren