Top Cryptocurrency News Site Traffic
Hi all, halo gais
Sometimes I have question about if there is any market stock news site, how about cryptocurrency market ? is there any site to provide specific information about crypto and their traffic? based on question I do mini research about what is the most Cryptocurrency news website based on traffic and of course visualize it.
Okay first, I dont have any list about the website, I find it on google keyword ‘cryptocurrency’ and ‘crypto’ ‘bitcoin’ or maybe ‘blockchain’ (without mark ‘’) and some information provide by tradingview news page, you will find similar site to give information spesific crypto only so thats why im not conclude big news site like Bloomberg, bbc, RT, CNBC, reuters … Etc
Second, Prepare the dataset here the tool i used : Python and their libraries, Jupiter Notebook and SEO Website analytics SEranking to collect information about traffic site and export as dataset. My dataset has been analyzed with SEranking tools with highest traffic from US Region.
Third, Cleansing data and visualizing as treemap and Horizontal bar chart with python (I’m learning python that’s why I visualize in python). In data visualization of course you can use other tool ex:Tableau, google data studio and other, but here im using jupiter notebook and python with their prequerities or libraries.
and sorry if i have bad write or grammar in english, so lets get started.
Step 1 Check version of libraries python, importing prequerities and dataset.
import squarify ##for plotting treemap visualization
import seaborn as sns ##my seaborn version 1.3.4
import matplotlib.pyplot as plt
import matplotlib #my matplotlib version 3.4.3
import pandas as pd #my panda version 1.3.4
from matplotlib import style#Read Csv dataset
#df is dataframe and you can rename it as you wish but keep in mind you must call same name df in next step otherwise your python will failure to take dataframedf = pd.read_csv('Cryptonews.csv')
df
# Read CSV dataset, add 'percentage' and sort by highest
# '2' is decimal separate number from dataset
df['Percentage'] = round(100 * df['all trafic'] / sum(df['all trafic']), 2)
df = df.sort_values(by='all trafic', ascending=False)
df
Output :
Step 2 Dataset cleaning
if you check the step 1 output you will see the highest traffic and lowest, then I will grouping some website have lowest amount of traffic below 1 % into the name : ‘others’
#first make duplicate dataframe (df) set website column as index
df_copy = df.copy().set_index(‘Website’)#second aggregate data from duplicated df with website column
df_regroup = df_copy.loc['Bitcoinmagazine.com':,]
df_regroup['group'] = 1
df_regroup = df_regroup.groupby('group').agg({
'Organic Traffic': 'sum',
'Paid Traffic': 'sum',
'all trafic': 'sum',
'Period': 'first',
'Percentage': 'sum'
}).reset_index().drop(columns='group')
df_regroup['Website'] = 'Others'#last grouping dataset and make new dataframe as df2
#df iloc 7 is the row website to keep and above 1%
df2 = pd.concat([df.iloc[:7], df_regroup])
df2
Output
Step 3 Setting data for Treemap and create label
# Plotting treemap parameter
x = 5
y = 5
width = 100.
height = 100.
cmap = matplotlib.cm.plasma_r #plasma is colormap from python # Min and Max to set Treemap color
# df2 is new dataset from step 2
mini = min(df2["all trafic"])
maxi = max(df2["all trafic"])# Normalize color value from min max
norm = matplotlib.colors.Normalize(vmin=mini, vmax=maxi)
colors = [cmap(norm(value)) for value in df2["all trafic"]]# last create label for treemap
df2["Label"] = df2["Website"] + "\n (" + df2["Percentage"].astype("str") + "%)"
df2
Output
last step make 2 chart and plotting in one picture
fig, ax = plt.subplots(1,2, figsize=(25, 9), dpi=144)
fig.suptitle('Top Cryptonews Website Traffic \n Period Jan 2016 - March 2022', fontsize=25, color='black')# Plot 1 (HORIZONTAL BAR CHART)
barplot = sns.barplot(ax=ax[0],
x = "all trafic",
y = "Website", data= df, palette='plasma')
barplot.xaxis.set_visible(False)
barplot.set_facecolor('none')
for tick in barplot.yaxis.get_major_ticks():
tick.label.set_fontsize(17)for p in barplot.patches:
width = p.get_width()
barplot.text(width + 1,
p.get_y() + p.get_height() / 2,
'{:,.0f}'.format(width),
va = 'center',
color='black', size=16
)
# Plot 2
treemap = squarify.plot(df2['Percentage'],
color=colors,
label=df2.Label,
alpha=.55,
text_kwargs={'color':'black', 'size':12},
bar_kwargs=dict(linewidth=3, edgecolor="black"),
ax=ax[1] ) ### this second plot
)img = plt.imshow([df2.Percentage], cmap='plasma_r', vmax = 90, vmin = 350)
img.set_visible(False)
cb = fig.colorbar(img, orientation="horizontal", aspect=30, pad=0.05, shrink=0.54)
cb.ax.invert_xaxis()
fig.text(.74, .165, "Traffic (in million)", fontsize=16, color='black')## Added detail
fig.text(.75, 0.025,
"* Some website traffic started 2017-2019 \n Benzinga, Newsbtc, Cryptonews, Cryptopotato, Cryptocrunchapp",
fontsize=15,
ha="center", color='black')plt.tight_layout()
plt.axis('off')
plt.savefig("Cryptonews Website Traffic2.png")
plt.show()
Final Output
Here is my reference :