Visualizing Conversion Rate By Hour In Nightingale Rose Chart
2 min readApr 29, 2020
Using Nightingale Rose Chart is an insightful way to visualize hour trends in your SEM account.
It is important to understand how the data looks across the different hours of the day to modify bids accordingly.
The script
First, let’s import dependencies:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context(‘poster’)
sns.set_style(‘white’)
%pylab inline
Now we import the conversion rate by hour data and clean it:
data = pd.read_csv(“cr_by_hour.csv”, skiprows=2)
data[‘Conv. rate’] = data[‘Conv. rate’].str.replace(“%”,””)
data.columns = [‘hour’,’cr’]
data = data.sort_values(by=”hour”)
data
We will need to convert our columns to arrays:
cr = data[“cr”].astype(‘float’).to_numpy()
hour = data[“hour”].astype(‘float’).to_numpy()
Now let’s create the chart
N = 24
bottom = 2theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False)
width = (2*np.pi) / Nplt.figure(figsize = (16, 10))
ax = plt.subplot(111, polar=True)
bars = ax.bar(theta, cr, width=width, bottom=bottom)
ax.set_theta_zero_location(“N”)
ax.set_theta_direction(-1)ticks = [‘0:00’, ‘3:00’, ‘6:00’, ‘9:00’, ‘12:00’, ‘15:00’, ‘18:00’, ‘21:00’]
ax.set_xticklabels(ticks)plt.show()