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.

Calculating metrics

Calculating metrics

- Let's being with calculating some metrics for pandas. First we will import pandas, then we'll import our data. Now this data is a blend of data from Google search consult and Google Analytics page data, and we'll be able to see that now. There we go. Everything looks okay. If we look at the info to see how the data is comprised, we see three objects. Now I wouldn't have expected to see three objects cause the page is only the real object there except from CTR has a special character in it and the timestamp has zero days in it, so they're object. We're going to change the CTR by recalculating it from clicks and impressions. So we're going to recreate CTR from clicks and impressions. To do this, what we want to do is, because we want to overwrite the CTR field, we're going to select it and say equals, and then we're going to create a calculation here, and that is selecting the column Clicks and then dividing it by…

Contents