File size: 887 Bytes
5146163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pandas as pd
from scipy.stats import pearsonr

df = pd.read_csv("traffic.csv")

total_pageviews = df['pageviews'].sum()
average_daily_pageviews = df['pageviews'].mean()

print("Total Pageviews:", total_pageviews)
print("Average Daily Pageviews:", average_daily_pageviews)

total_events = df['events'].sum()
event_distribution = df['events'].value_counts()

print("Total Events:", total_events)
print("Event Distribution:\n", event_distribution)

country_distribution = df.groupby('country')['pageviews'].sum()

print("Geographical Distribution:\n", country_distribution)

df['CTR'] = df['clicks'] / df['pageviews']  # Calculate CTR
overall_ctr = df['CTR'].mean()

print("Overall CTR:", overall_ctr)
print("CTR by Link:\n", df.groupby('link')['CTR'].mean())

correlation, _ = pearsonr(df['pageviews'], df['clicks'])

print("Correlation between Pageviews and Clicks:", correlation)