Changing series values
During the data cleaning process, we often need to change the values in a data series or create a new one. We can change all the values in a series, or just the values in a subset of our data. Most of the techniques we have been using to get values from a series can be used to update series values, though some minor modifications are necessary.
We will work with the overall high school GPA column from the National Longitudinal Survey in this recipe.
How to do it…
We can change the values in a pandas series for all rows, as well as for selected rows. We can update a series with scalars, by performing arithmetic operations on other series, and by using summary statistics. Let's take a look at this: