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.

Replacing missing Facebook Ad data

Replacing missing Facebook Ad data - Python Tutorial

From the course: Python for Marketing (2019)

Replacing missing Facebook Ad data

- This is going to be an incredibly quick tutorial, but I'm going to highlight a very very useful tool in the pandas toolkit. Whenever you get NANs, so not a number, these guys, you sometimes get them en masse, and they're all over a dataset, but you want to replace them. You can replace them using a function called "fillna," so it basically looks for NANs, or NaNs, and then replaces them with whatever value you give it. In this case, we're going to be really simplistic, and we're just going to fill the NA with a zero, but you could put a mean in there, you could put anything you like. You know your datasets, so you will be able to decide what the best fill value is. So once we have called "fillna," on the data frame, and passed zero as the fill option, and then in place, we will have overwritten that view of the data. Have a look ahead, there we go. Just like that, all these values cleaned up in one go. So that is how…

Contents