CommencerCommencer gratuitement

What's your rating, Harry?

You fix yourself a coffee and keep working on your book project. For your next task, you need to get an appropriate dataset containing ratings for all the Harry Potter books. You gathered data from Goodreads as well as from Amazon.

You realized that you need a long format, but the dataset hp_books is in a wide format. You want to melt the data, but first, you need to manipulate some of the string columns.

The full title is divided into two columns. The authors column contains info about the writer and the illustrator.

Ratings for the Harry Potter books are in the DataFrame hp_books. 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.

# Concatenate the title and subtitle separated by "and" surrounded by spaces
hp_books['full_title'] = ____[____].____.____(____, sep =____) 

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