1. Learn
  2. /
  3. Courses
  4. /
  5. Reshaping Data with pandas

Connected

Exercise

Time to read, Katniss!

It's almost time to finish working for the day. But first, you would like to do an analysis for fun. You will analyze another book dataset, this time with the Hunger Games series.

You explored the dataset books_hunger before reshaping it, but something was not right. The index of the DataFrame contains the title of the books. You know that you cannot reshape it in this format. If you do, you will lose valuable data, the title, so you'll need to make some changes before transforming the DataFrame.

The books_hunger dataset is available for you. It contains the title, and data about language, publication date, publication number, and page number of each book.

Instructions

100 XP
  • Modify the books_hunger DataFrame by resetting the index without dropping it.
  • Reshape books_hunger from wide to long format. Use the columns title and language as unique indexes. Name feature the new variable created from the columns that starts with publication and page. Those columns are separated by a blank space and end in a word.