Join Michele Vallisneri for an in-depth discussion in this video Solution, part of Introduction to Data Analysis with Python.
- 03_05_challenge_begin.…Let's select that.…Remember that the first objective in the challenge…was to divide the list of words based on words length…in a defaultdict, and then adding words from a list…using their length as the key.…We've called the dictionary words_bylength.…Remember, the key is the length of the word,…and since each value starts as an empty list,…we can just append to it.…
This is as we expected,…a dictionary of lists of words…indexed by word length.…Next, we need to find the anagrams in each class.…We'll collect them in another Python dict,…that we'll call anagrams_bylength.…We go through the pairs of word lengths and word lists…in the words_bylength dictionary.…Remember that we can iterate over keys and values together…using the items method of a dict.…Python dict of anagrams in this class,…excluding trigger ones,…and we assign it to the correct item in the dictionary.…
Here we go.…Again, it's what we expect.…For each word length, we have a dictionary…of lists of anagrams, indexed by the word being anagrammed.…
- Writing and running Python in iPython
- Using Python lists and dictionaries
- Creating NumPy arrays
- Indexing and slicing in NumPy
- Downloading and parsing data files into NumPy and Pandas
- Using multilevel series in Pandas
- Aggregating data in Pandas
Skill Level Intermediate
1. Installation and Setup
2. Refresher: Data Containers in Python
3. Word Anagrams in Python
4. Introduction to NumPy
5. Weather Data with NumPy
6. Introduction to Pandas
7. Baby Names with Pandas
Next steps1m 36s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.