Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SERP Analysis - Plot Click Through Rate (CTR) by Position
df_by_position = df.groupby(df.position.apply(lambda x: round(x, 0))).agg({
"clicks": "sum", "impressions": "sum"
})
df_by_position['ctr'] = (df_by_position.clicks / df_by_position.impressions)*100
df_by_position[df_by_position.index <= 20].ctr.plot(title="Click Through Rate (CTR) by Position")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.