Changing Series values conditionally
Changing Series values is often more complicated than the previous recipe suggests. We often need to set Series values based on the values of one or more other Series for that row of data. This is complicated further when we need to set Series values based on values from other rows; say, a previous value for an individual, or the mean for a subset. We will deal with these complications in this and the next recipe.
Getting ready
We will work with land temperature data and the NLS data in this recipe.
Data note
The land temperature dataset contains the average temperature readings (in Celsius) in 2023 from over 12,000 stations across the world, though the majority of the stations are in the United States. The raw dataset was retrieved from the Global Historical Climatology Network integrated database. It has been made available for public use by the United States National Oceanic and Atmospheric Administration at https:/...