Cleaning and Exploring Data with Series Operations
We can view the recipes in the first few chapters of this book as, essentially, diagnostic. We imported some raw data and then generated descriptive statistics about key variables. This gave us a sense of how the values for those variables were distributed and helped us identify outliers and unexpected values. We then examined the relationships between variables to look for patterns, and deviations from those patterns, including logical inconsistencies. In short, our primary goal so far has been to figure out what is going on with our data.
But, not very long into a data exploration and cleaning project, we invariably need to alter the initial values for some of our variables across some of our observations. For example, we might need to create a new column that is based on the values of one or more other columns. Or, we might want to change values that are in a certain range, say less than 0, or over some threshold amount, perhaps...