From the course: Python for Marketing

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Plot cost-per-click marketing data

Plot cost-per-click marketing data - Python Tutorial

From the course: Python for Marketing

Plot cost-per-click marketing data

- Looking to take control of your advertising expenses? Visualizing cost per click, or CPC data, is the key to evaluating your advertising costs and optimizing your budget decisions. In this lesson, I'll be showing you how to plot cost-per-click data in Python using pandas and Matplotlib. Start by opening up plot_cpc_data.ipynb to follow along. This notebook has the relevant libraries imported and cpc_data.csv loaded into a DataFrame. This dataset contains cost per click or CPC data across time. Your goal is to visualize cost by creating three plots overlaid, comparing the original data, which is measured at a daily interval, against weekly, resampled averages and against weekly rolling averages. Start by resampling the data by week and taking the average. Call .resample and pass in capital W as a string, followed by .mean. Now create a rolling seven-day window. Call .rolling and pass in window = 7 and center = True, followed by .mean. Next, create a data visualization that plots the…

Contents