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!
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.
# Melt the rating and rating_count using title, authors and publisher as identifiers
books_ratings = books_gothic.____(____=____,
____=____)
# Print books_ratings
print(books_ratings)