Chapter 10. Working with Data: Data Manipulation
Sometimes your data isn’t arranged in the way it needs to be.
Perhaps you have a isn’t arranged in the way it needs to be.list of lists, but you really need a dictionary of dictionaries. Or perhaps you need to relate a value in one data structure to a value in another, but the values don’t quite match. Urrgh, that’s so frustrating. Not to worry: the power of Python is here to help. In this chapter, you’ll use Python to wrangle your data to change the scraped data from the end of the previous chapter into something truly useful. You’ll see how to exploit Python’s dictionary as a lookup table. There’s conversions, integrations, updates, deployments, and more in this chapter. And, at the end of it all, the Coach’s napkin-spec becomes reality. Can’t wait? Neither can we… let’s get to it!
Bending your data to your will…
You’ve now written the code that completes three of the five data manipulation tasks:
Grab the raw HTML page from Wikipedia. 
Identify the tables that contain the data you need. Process the first two columns of each ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access