From the course: Python for Marketing (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Creating alerts with actions

Creating alerts with actions - Python Tutorial

From the course: Python for Marketing (2019)

Creating alerts with actions

- [Instructor] Now we actually get to create something. We're going to create a function that gives us an alert based on whether the traffic is up, no change, and down. And if it's down, it's going to give us a little bit more information than just the traffic is down. So in order to do this, we've created this function that takes three arguments. So it takes the data frame, it takes the start date, and it takes the end date. So the start date and the end date are here. This is where we have set those, and if we'll look through, we're creating a mask, and in that mask we are looking for the index dates between start and end. So we're going to look up these values, and what it'll do is it will create a data frame with the values of these two index dates. Then, we're going to apply the mask to our data frame, work out the difference, select the max difference because we might end up with a NaN, and then pull the actual…

Contents