World Press Freedom Index 2020
Posted on mer. 02 septembre 2020 in Politics • 2 min read
World Press Freedom Index 2020¶
The Press Freedom Index, yearly produced by Reporters Without Borders is a ranking of 180 countries which attempts to represent the degree of freedom that journalists, media, and netizens have in each country. The index is calculated on a scale from 0 to 100, the higher a country's score, the more worrying the press situation is. Using RSF data, we will visually represent this index of press freedom on maps.
Import required libraries¶
In [1]:
import pandas as pd
import plotly.express as px
import plotly.io as pio
from IPython.display import Javascript
Javascript(
"""require.config({
paths: {
plotly: 'https://cdn.plot.ly/plotly-latest.min'
}
});"""
)
pio.renderers.default = 'notebook_connected'
Data pre-processing¶
In [2]:
df = pd.read_csv('Data/World_Press_Freedom_Index_2020.csv',
header=0,
sep=';',
usecols= ['ISO','Rank2020','EN_country', 'Score 2020']
)
df.head()
Out[2]:
In [3]:
fig = px.choropleth(df, locations='ISO',
color='Score 2020',
hover_name='EN_country',
range_color=[0,100],
scope='world',
labels={'Score 2020':'Press Freedom Index'},
color_continuous_scale=px.colors.diverging.Portland,
title='<b>World Press Freedom Index 2020</b><br>' +
'<i>Source : Reporters Without Borders</i>'
)
# Style
fig.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
fig.show()
This press freedom map presents a visual summary of the performance of countries in the world ranking according to Reporters Without Borders. To better visualize these results, we will now generate the maps at the regional level.
Europe map¶
In [4]:
fig = px.choropleth(df, locations='ISO',
color='Score 2020',
hover_name='EN_country',
range_color=[0,100],
scope='europe',
labels={'Score 2020':'Press Freedom Index'},
color_continuous_scale=px.colors.diverging.Portland,
title='<b>Press Freedom Index 2020 in Europe</b><br>' +
'<i>Source : Reporters Without Borders</i>'
)
# Style
fig.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20,
)
fig.show()
North America map¶
In [5]:
fig = px.choropleth(df, locations='ISO',
color='Score 2020',
hover_name='EN_country',
range_color=[0,100],
scope='north america',
labels={'Score 2020':'Press Freedom Index'},
color_continuous_scale=px.colors.diverging.Portland,
title='<b>Press Freedom Index 2020 in North America</b><br>' +
'<i>Source : Reporters Without Borders</i>'
)
# Style
fig.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
fig.show()
South America map¶
In [6]:
fig = px.choropleth(df, locations='ISO',
color='Score 2020',
hover_name='EN_country',
range_color=[0,100],
scope='south america',
labels={'Score 2020':'Press Freedom Index'},
color_continuous_scale=px.colors.diverging.Portland,
title='<b>Press Freedom Index 2020 in South America</b><br>' +
'<i>Source : Reporters Without Borders</i>'
)
# Style
fig.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
fig.show()
Africa map¶
In [7]:
fig = px.choropleth(df,
locations='ISO',
color='Score 2020',
hover_name='EN_country',
range_color=[0,100],
scope='africa',
labels={'Score 2020':'Press Freedom Index'},
color_continuous_scale=px.colors.diverging.Portland,
title='<b>Press Freedom Index 2020 in Africa</b><br>' +
'<i>Source : Reporters Without Borders</i>'
)
# Style
fig.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
fig.show()
Asia map¶
In [8]:
fig = px.choropleth(df, locations='ISO',
color='Score 2020',
hover_name='EN_country',
range_color=[0,100],
scope='asia',
labels={'Score 2020':'Press Freedom Index'},
color_continuous_scale=px.colors.diverging.Portland,
title='<b>Press Freedom Index 2020 in Asia</b><br>' +
'<i>Source : Reporters Without Borders</i>'
)
# Style
fig.update_layout(
font_family='Helvetica',
font_color='grey',
font_size=12,
title_font_size=20
)
fig.show()
Sources¶