Elementary, dear Watson!
It's Friday, and you are about to finish working on your book project. For your last task, you will analyze data about Arthur Conan Doyle's books.
You realize your dataset, books_sh
, needs reshaping. You notice there are columns that can be grouped using a prefix. You identify the columns to use as unique IDs. However, some of these columns contain strings. They need some manipulation before applying a wide to long transformation. You decide some of the strings need splitting to make the DataFrame cleaner.
The books_sh
dataset is available for you. It contains the title, and data about version
, number_pages
, and number_ratings
of each book.
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.
# Split main_title by a colon and assign it to two columns named title and subtitle
books_sh[['title', 'subtitle']] = ____[____].____.____(____, ____=____)
# Print books_sh
print(books_sh)