Get startedGet started for free

Did you say dystopia?

Another day at work, another day working with your book project! You are very excited because you have been making a lot of progress. You plan to work on a dataset about dystopian fiction books.

But first, you need to do some string manipulations. You realize that the DataFrame index contains data about the title and the release year. You can't find a column with the author of the book, so you decide to pre-define a list of the writers. Then, you want to delete the year and replace it with the author.

You decide that splitting the index and then concatenating it with the list is the best way to do it.

The books_dys dataset and author_list are available for you. Make sure to examine it in the console!

This exercise is part of the course

Reshaping Data with pandas

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Split the index of books_dys by the hyphen 
books_dys.index = books_dys.____.____.____(____)

# Print books_dys
print(books_dys)
Edit and Run Code