Chapter 8
Reshaping Data
IN THIS CHAPTER
Understanding the bag of words model
Working with n-grams for sequencing your data items
Implementing Term Frequency times Inverse Document Frequency (TF-IDF) transformations
Manipulating graph data
The previous chapter, Chapter 7, demonstrates techniques for working with data as an entity — as something you work with in Python. But data doesn’t exist in a vacuum. It doesn’t just suddenly appear within Python for absolutely no reason at all. As demonstrated in Chapter 6, you load the data; however, loading may not be enough — you may have to reshape the data as part of loading it. That’s the purpose of this chapter. You discover how to work with a variety of container types in a way that enables you to load data from a number of complex container types.
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
As you progress through the book, you discover that data takes all kinds of forms and shapes. As far as the computer is concerned, data consists of 0s and 1s. Humans give the data meaning by ...