Unfortunately, much of the data you get to work with is not immediately useful for a data science project. A major part of the work on such a project is the data preparation part. There are many different issues you could have with your data. You might have some missing values in it. Maybe you need to group some continuous variables in a limited number of bins—this means having to bin or to discretize them. Immediately, you realize that the discretionary is not a particularly straightforward process. Maybe you need to create numerical variables from categorical ones. You create so-called dummy variables, or dummies, from values of a categorical variable. Sometimes, you need to aggregate data over some groups defined with one or more variables, and further operate on aggregated data.
This chapter will introduce you to some of the basic data preparation tasks...