Session Ready
Exercise

Exercise 1

In this case study, we will find and visualize summary statistics of the text of different translations of Hamlet. For this case study, functions count_words_fast, read_book, and word_stats are already defined as in the Case 2 Videos (Videos 3.2.x).

book_titles is a nested dictionary, containing book titles within authors within languages, all of which are strings. These books are all stored online, and are accessed throughout this case study. In this exercise, we will first read in and store each translation of Hamlet.

Instructions
100 XP
  • Define hamlets as a pandas dataframe with columns language and text.
  • Add an if statement to check if the title is equal to 'Hamlet'.
  • Store the results from read_book(inputfile) to text.
  • Consider: How many translations are there? Which languages are they translated into?