{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", "_kg_hide-input": false, "_kg_hide-output": true, "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", "execution": { "iopub.execute_input": "2020-12-11T00:27:29.757824Z", "iopub.status.busy": "2020-12-11T00:27:29.756991Z", "iopub.status.idle": "2020-12-11T00:27:30.927520Z", "shell.execute_reply": "2020-12-11T00:27:30.926844Z" }, "papermill": { "duration": 1.197445, "end_time": "2020-12-11T00:27:30.927632", "exception": false, "start_time": "2020-12-11T00:27:29.730187", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "./input\\2015.csv\n", "./input\\2016.csv\n", "./input\\2017.csv\n", "./input\\2018.csv\n", "./input\\2019.csv\n", "./input\\2020.csv\n" ] } ], "source": [ "import numpy as np\n", "import pandas as pd\n", "import plotly.express as px\n", "\n", "import os\n", "\n", "PATHS = []\n", "\n", "for dirname, _, filenames in os.walk('./input'):\n", " for filename in filenames:\n", " print(os.path.join(dirname, filename))\n", " \n", " PATHS.append(os.path.join(dirname, filename))\n", " \n", "\n", "PATHS.sort()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "_kg_hide-input": true, "execution": { "iopub.execute_input": "2020-12-11T00:27:30.959638Z", "iopub.status.busy": "2020-12-11T00:27:30.958995Z", "iopub.status.idle": "2020-12-11T00:27:30.977681Z", "shell.execute_reply": "2020-12-11T00:27:30.976782Z" }, "papermill": { "duration": 0.037043, "end_time": "2020-12-11T00:27:30.977814", "exception": false, "start_time": "2020-12-11T00:27:30.940771", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "# 2020\n", "df = pd.read_csv(PATHS[-1])" ] }, { "cell_type": "markdown", "metadata": { "_cell_guid": "79c7e3d0-c299-4dcb-8224-4455121ee9b0", "_uuid": "d629ff2d2480ee46fbb7e2d37f6b5fab8052498a", "collapsed": true, "papermill": { "duration": 0.018088, "end_time": "2020-12-11T00:27:31.014723", "exception": false, "start_time": "2020-12-11T00:27:30.996635", "status": "completed" }, "tags": [] }, "source": [ "Analysis of World Happiness\n", "=======================================\n", "\n", "\n", "## Introduction\n", "World Happiness Report is a ranking of 156 countries. Nationally representative samples of respondents are asked to rate their own current lives on that 0 to 10 scale, with the best possible life for them being a 10, and the worst possible experience 0.\n", "\n", "## Goals\n", "They are a few goals I want out of this data set:\n", "+ Identify the happiest and unhappiest countries, and contributing features.\n", "+ Identify any trends in the dataset and predict how countries happiness scores will look in the future.\n", "\n", "While I would like to predict the happiness score, as the columns: GDP per Capita, Family, Life Expectancy, Freedom, Generosity, Trust Government Corruption add up to equal the Happiness score, making it unrealiable to to predict on. With that said I do plan on extending this data set with educational data, and trying to predict off that.\n", "\n", "## Source\n", "The data was sourced from Kaggle at: https://www.kaggle.com/mathurinache/world-happiness-report, which itself is based on https://worldhappiness.report/ed/2020/ (Cite: Helliwell, John F., Richard Layard, Jeffrey Sachs, and Jan-Emmanuel De Neve, eds. 2020. World Happiness Report 2020. New York: Sustainable Development Solutions Network)" ] }, { "cell_type": "markdown", "metadata": { "papermill": { "duration": 0.018098, "end_time": "2020-12-11T00:27:31.051614", "exception": false, "start_time": "2020-12-11T00:27:31.033516", "status": "completed" }, "tags": [] }, "source": [ "## Basic Infomation\n", "\n", "Let's get some general information for the 2020 data. From the data below we can see that we have no null data and the vast majority of the data is in numerical form, which is good as it means we can avoid cleaning the data." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "_kg_hide-input": true, "execution": { "iopub.execute_input": "2020-12-11T00:27:31.116898Z", "iopub.status.busy": "2020-12-11T00:27:31.116139Z", "iopub.status.idle": "2020-12-11T00:27:31.121113Z", "shell.execute_reply": "2020-12-11T00:27:31.120469Z" }, "papermill": { "duration": 0.051321, "end_time": "2020-12-11T00:27:31.121222", "exception": false, "start_time": "2020-12-11T00:27:31.069901", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The shape is: 153, 20\n", "\n", "RangeIndex: 153 entries, 0 to 152\n", "Data columns (total 20 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Country name 153 non-null object \n", " 1 Regional indicator 153 non-null object \n", " 2 Ladder score 153 non-null float64\n", " 3 Standard error of ladder score 153 non-null float64\n", " 4 upperwhisker 153 non-null float64\n", " 5 lowerwhisker 153 non-null float64\n", " 6 Logged GDP per capita 153 non-null float64\n", " 7 Social support 153 non-null float64\n", " 8 Healthy life expectancy 153 non-null float64\n", " 9 Freedom to make life choices 153 non-null float64\n", " 10 Generosity 153 non-null float64\n", " 11 Perceptions of corruption 153 non-null float64\n", " 12 Ladder score in Dystopia 153 non-null float64\n", " 13 Explained by: Log GDP per capita 153 non-null float64\n", " 14 Explained by: Social support 153 non-null float64\n", " 15 Explained by: Healthy life expectancy 153 non-null float64\n", " 16 Explained by: Freedom to make life choices 153 non-null float64\n", " 17 Explained by: Generosity 153 non-null float64\n", " 18 Explained by: Perceptions of corruption 153 non-null float64\n", " 19 Dystopia + residual 153 non-null float64\n", "dtypes: float64(18), object(2)\n", "memory usage: 24.0+ KB\n" ] } ], "source": [ "print(\"The shape is: {}, {}\".format(df.shape[0], df.shape[1]))\n", "df.info()\n", "## Rename\n", "df.rename({\"Ladder score\": \"Happiness score\"},axis=1, inplace=True)" ] }, { "cell_type": "markdown", "metadata": { "papermill": { "duration": 0.012368, "end_time": "2020-12-11T00:27:31.146273", "exception": false, "start_time": "2020-12-11T00:27:31.133905", "status": "completed" }, "tags": [] }, "source": [ "# Country Happiness\n", "Let us now observe the happiest and the unhappiest ranked countries in the dataframe.\n", "\n", "We display the the happiest 5 and the unhappiest 5 countries." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "_kg_hide-input": true, "execution": { "iopub.execute_input": "2020-12-11T00:27:31.184951Z", "iopub.status.busy": "2020-12-11T00:27:31.180201Z", "iopub.status.idle": "2020-12-11T00:27:32.760216Z", "shell.execute_reply": "2020-12-11T00:27:32.759620Z" }, "papermill": { "duration": 1.601466, "end_time": "2020-12-11T00:27:32.760355", "exception": false, "start_time": "2020-12-11T00:27:31.158889", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Finland", "marker": { "color": "#636efa" }, "name": "Finland", "offsetgroup": "Finland", "orientation": "h", "showlegend": true, "text": [ 7.808700085 ], "textposition": "auto", "type": "bar", "x": [ 7.808700085 ], "xaxis": "x", "y": [ "Finland" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Denmark", "marker": { "color": "#EF553B" }, "name": "Denmark", "offsetgroup": "Denmark", "orientation": "h", "showlegend": true, "text": [ 7.645599842 ], "textposition": "auto", "type": "bar", "x": [ 7.645599842 ], "xaxis": "x", "y": [ "Denmark" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Switzerland", "marker": { "color": "#00cc96" }, "name": "Switzerland", "offsetgroup": "Switzerland", "orientation": "h", "showlegend": true, "text": [ 7.559899807000001 ], "textposition": "auto", "type": "bar", "x": [ 7.559899807000001 ], "xaxis": "x", "y": [ "Switzerland" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Iceland", "marker": { "color": "#ab63fa" }, "name": "Iceland", "offsetgroup": "Iceland", "orientation": "h", "showlegend": true, "text": [ 7.504499912000001 ], "textposition": "auto", "type": "bar", "x": [ 7.504499912000001 ], "xaxis": "x", "y": [ "Iceland" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Norway", "marker": { "color": "#FFA15A" }, "name": "Norway", "offsetgroup": "Norway", "orientation": "h", "showlegend": true, "text": [ 7.487999916000001 ], "textposition": "auto", "type": "bar", "x": [ 7.487999916000001 ], "xaxis": "x", "y": [ "Norway" ], "yaxis": "y" } ], "layout": { "barmode": "relative", "legend": { "title": { "text": "Country name" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Happiness score" } }, "yaxis": { "anchor": "x", "categoryarray": [ "Norway", "Iceland", "Switzerland", "Denmark", "Finland" ], "categoryorder": "array", "domain": [ 0, 1 ], "title": { "text": "Country name" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Afghanistan", "marker": { "color": "#636efa" }, "name": "Afghanistan", "offsetgroup": "Afghanistan", "orientation": "h", "showlegend": true, "text": [ 2.566900015 ], "textposition": "auto", "type": "bar", "x": [ 2.566900015 ], "xaxis": "x", "y": [ "Afghanistan" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "South Sudan", "marker": { "color": "#EF553B" }, "name": "South Sudan", "offsetgroup": "South Sudan", "orientation": "h", "showlegend": true, "text": [ 2.8166000839999996 ], "textposition": "auto", "type": "bar", "x": [ 2.8166000839999996 ], "xaxis": "x", "y": [ "South Sudan" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Zimbabwe", "marker": { "color": "#00cc96" }, "name": "Zimbabwe", "offsetgroup": "Zimbabwe", "orientation": "h", "showlegend": true, "text": [ 3.2992000580000003 ], "textposition": "auto", "type": "bar", "x": [ 3.2992000580000003 ], "xaxis": "x", "y": [ "Zimbabwe" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Rwanda", "marker": { "color": "#ab63fa" }, "name": "Rwanda", "offsetgroup": "Rwanda", "orientation": "h", "showlegend": true, "text": [ 3.312299967 ], "textposition": "auto", "type": "bar", "x": [ 3.312299967 ], "xaxis": "x", "y": [ "Rwanda" ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "Country name=%{y}
Happiness score=%{text}", "legendgroup": "Central African Republic", "marker": { "color": "#FFA15A" }, "name": "Central African Republic", "offsetgroup": "Central African Republic", "orientation": "h", "showlegend": true, "text": [ 3.475899935 ], "textposition": "auto", "type": "bar", "x": [ 3.475899935 ], "xaxis": "x", "y": [ "Central African Republic" ], "yaxis": "y" } ], "layout": { "barmode": "relative", "legend": { "title": { "text": "Country name" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Happiness score" } }, "yaxis": { "anchor": "x", "categoryarray": [ "Central African Republic", "Rwanda", "Zimbabwe", "South Sudan", "Afghanistan" ], "categoryorder": "array", "domain": [ 0, 1 ], "title": { "text": "Country name" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = px.bar(\n", " data_frame = df.nlargest(5,\"Happiness score\"),\n", " y=\"Country name\",\n", " x=\"Happiness score\",\n", " orientation='h',\n", " color=\"Country name\",\n", " text=\"Happiness score\")\n", "\n", "fig.show()\n", "\n", "fig = px.bar(\n", " data_frame = df.nsmallest(5,\"Happiness score\"),\n", " y=\"Country name\",\n", " x=\"Happiness score\",\n", " orientation='h',\n", " color=\"Country name\",\n", " text=\"Happiness score\")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": { "papermill": { "duration": 0.015019, "end_time": "2020-12-11T00:27:32.791092", "exception": false, "start_time": "2020-12-11T00:27:32.776073", "status": "completed" }, "tags": [] }, "source": [ "We can see from the graphs that the happiest countries are all Scandinavian, with the exception of Switzerland, and the unhappiest all are in Sub-Sahara/central Africa, with the exception of Afghanistan.\n", "\n", "It is also worth noting that all the happiest countries are in western Europe, and are highly socialised countries (with Switzerland being able to be regarded as both incredible socialist or incredibly capitalist.) Similarly, the unhappiest countries are not surprising, given Sub-Sahara Africa's war, disease and civil arrest, a history which Afghanistan shares.\n", "\n", "Given these results and how tightly related to region the data appears to be, let us see how regions as a whole have been ranked on average.\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2020-12-11T00:27:32.850463Z", "iopub.status.busy": "2020-12-11T00:27:32.828882Z", "iopub.status.idle": "2020-12-11T00:27:32.899168Z", "shell.execute_reply": "2020-12-11T00:27:32.898265Z" }, "papermill": { "duration": 0.09291, "end_time": "2020-12-11T00:27:32.899298", "exception": false, "start_time": "2020-12-11T00:27:32.806388", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "Happiness score=%{text}
Regional indicator=%{y}", "legendgroup": "", "marker": { "color": "#636efa" }, "name": "", "offsetgroup": "", "orientation": "h", "showlegend": false, "text": [ 6.000400066, 5.540699959, 5.690599918, 6.13710022, 5.005099773, 7.227449893999999, 4.832799911, 5.353499889, 4.43200016, 7.093699932000001 ], "textposition": "auto", "type": "bar", "x": [ 6.000400066, 5.540699959, 5.690599918, 6.13710022, 5.005099773, 7.227449893999999, 4.832799911, 5.353499889, 4.43200016, 7.093699932000001 ], "xaxis": "x", "y": [ "Central and Eastern Europe", "Commonwealth of Independent States", "East Asia", "Latin America and Caribbean", "Middle East and North Africa", "North America and ANZ", "South Asia", "Southeast Asia", "Sub-Saharan Africa", "Western Europe" ], "yaxis": "y" } ], "layout": { "barmode": "relative", "legend": { "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Happiness score" } }, "yaxis": { "anchor": "x", "categoryorder": "total ascending", "domain": [ 0, 1 ], "title": { "text": "Regional indicator" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "regional = df.groupby(\"Regional indicator\")\n", "\n", "fig = px.bar(\n", " data_frame = regional.median(\"Happiness score\"),\n", " #y=\"\",\n", " x=\"Happiness score\",\n", " orientation='h',\n", " #color=df.index,\n", " text=\"Happiness score\",)\n", "\n", "fig.update_yaxes(categoryorder = \"total ascending\")\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": { "papermill": { "duration": 0.022469, "end_time": "2020-12-11T00:27:32.945031", "exception": false, "start_time": "2020-12-11T00:27:32.922562", "status": "completed" }, "tags": [] }, "source": [ "While our bottom region was as expected, our top region was North America, not Western Europe, which suggests that there is large variance in Western European Happiness. Let's see how wide our range of scores is then per region." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2020-12-11T00:27:32.999943Z", "iopub.status.busy": "2020-12-11T00:27:32.999279Z", "iopub.status.idle": "2020-12-11T00:27:33.121903Z", "shell.execute_reply": "2020-12-11T00:27:33.122428Z" }, "papermill": { "duration": 0.154721, "end_time": "2020-12-11T00:27:33.122567", "exception": false, "start_time": "2020-12-11T00:27:32.967846", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "Regional indicator=%{x}
Happiness score=%{y}", "legendgroup": "", "marker": { "color": "#636efa" }, "name": "", "notched": false, "offsetgroup": "", "orientation": "v", "showlegend": false, "type": "box", "x": [ "Western Europe", "Western Europe", "Western Europe", "Western Europe", "Western Europe", "Western Europe", "Western Europe", "North America and ANZ", "Western Europe", "Western Europe", "North America and ANZ", "North America and ANZ", "Western Europe", "Middle East and North Africa", "Latin America and Caribbean", "Western Europe", "Western Europe", "North America and ANZ", "Central and Eastern Europe", "Western Europe", "Middle East and North Africa", "Western Europe", "Western Europe", "Latin America and Caribbean", "East Asia", "Latin America and Caribbean", "Middle East and North Africa", "Western Europe", "Latin America and Caribbean", "Western Europe", "Southeast Asia", "Latin America and Caribbean", "Central and Eastern Europe", "Latin America and Caribbean", "Central and Eastern Europe", "Latin America and Caribbean", "Central and Eastern Europe", "Commonwealth of Independent States", "Latin America and Caribbean", "Middle East and North Africa", "Central and Eastern Europe", "Latin America and Caribbean", "Central and Eastern Europe", "Latin America and Caribbean", "Western Europe", "Latin America and Caribbean", "Central and Eastern Europe", "Middle East and North Africa", "Sub-Saharan Africa", "Commonwealth of Independent States", "Central and Eastern Europe", "Southeast Asia", "Central and Eastern Europe", "Southeast Asia", "Latin America and Caribbean", "Latin America and Caribbean", "Central and Eastern Europe", "Latin America and Caribbean", "Western Europe", "Latin America and Caribbean", "East Asia", "East Asia", "Latin America and Caribbean", "Central and Eastern Europe", "Latin America and Caribbean", "South Asia", "Latin America and Caribbean", "Latin America and Caribbean", "Central and Eastern Europe", "Commonwealth of Independent States", "Commonwealth of Independent States", "Central and Eastern Europe", "Commonwealth of Independent States", "Commonwealth of Independent States", "Commonwealth of Independent States", "Western Europe", "Western Europe", "East Asia", "Central and Eastern Europe", "Middle East and North Africa", "East Asia", "Southeast Asia", "Southeast Asia", "Southeast Asia", "Sub-Saharan Africa", "Sub-Saharan Africa", "South Asia", "Sub-Saharan Africa", "Commonwealth of Independent States", "Central and Eastern Europe", "Sub-Saharan Africa", "South Asia", "Middle East and North Africa", "East Asia", "Commonwealth of Independent States", "Central and Eastern Europe", "Middle East and North Africa", "Sub-Saharan Africa", "Latin America and Caribbean", "Middle East and North Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Southeast Asia", "Central and Eastern Europe", "Southeast Asia", "South Asia", "Sub-Saharan Africa", "Sub-Saharan Africa", "Middle East and North Africa", "Middle East and North Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Commonwealth of Independent States", "Commonwealth of Independent States", "Middle East and North Africa", "Middle East and North Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Commonwealth of Independent States", "Sub-Saharan Africa", "Middle East and North Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Middle East and North Africa", "Sub-Saharan Africa", "South Asia", "Sub-Saharan Africa", "Sub-Saharan Africa", "Southeast Asia", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Middle East and North Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Latin America and Caribbean", "Sub-Saharan Africa", "South Asia", "Sub-Saharan Africa", "Middle East and North Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "Sub-Saharan Africa", "South Asia" ], "x0": " ", "xaxis": "x", "y": [ 7.808700085, 7.645599842, 7.559899807000001, 7.504499912000001, 7.487999916000001, 7.448900223, 7.353499889, 7.2996001239999995, 7.294199944, 7.2375001910000005, 7.23210001, 7.222799778, 7.164500237, 7.128600121, 7.121399879, 7.093699932000001, 7.075799942000001, 6.939599991000001, 6.9109001160000005, 6.863500117999999, 6.790800095, 6.772799968999999, 6.663799762999999, 6.465000152999999, 6.45539999, 6.440100192999999, 6.406499863, 6.4008998870000005, 6.398900032, 6.38740015, 6.377099991000001, 6.375599861, 6.363399982000001, 6.34829998, 6.325200081, 6.304800033999999, 6.280600071, 6.257599831, 6.228499889, 6.227300167, 6.215499877999999, 6.1918997760000005, 6.1862998010000005, 6.163400172999999, 6.15899992, 6.13710022, 6.123700142000001, 6.102099895, 6.101299762999999, 6.0578999520000005, 6.0218000410000005, 6.006000042, 6.000400066, 5.9987998010000005, 5.974699974, 5.953199862999999, 5.9499998089999995, 5.925199986, 5.9109001160000005, 5.889800072000001, 5.872399807000001, 5.870800018, 5.796800137000001, 5.77820015, 5.747499942999999, 5.69329977, 5.6921000479999995, 5.6891999239999995, 5.674099922000001, 5.607500076, 5.555699825, 5.54610014, 5.546000004, 5.541500092000001, 5.539899826, 5.53550005, 5.514999866, 5.510399818, 5.504700184, 5.488800049, 5.4562001229999995, 5.384300232, 5.353499889, 5.285600185, 5.233300208999999, 5.21600008, 5.197599888, 5.1943998339999995, 5.164800167, 5.1598000530000006, 5.1479997630000005, 5.137199879, 5.131800175, 5.123899937, 5.119100093999999, 5.101500034, 5.094799995, 5.084899902, 5.053199768, 5.005099773, 4.980800152, 4.949299812, 4.909599781, 4.888599873, 4.882699966000001, 4.8484001160000005, 4.832799911, 4.829299927, 4.814099789, 4.7848000530000006, 4.771500111, 4.768700123, 4.750599861, 4.729300021999999, 4.724100113, 4.676799774, 4.672599792, 4.672399998, 4.6333999630000005, 4.623600006, 4.583000183, 4.571100235, 4.56069994, 4.557899952, 4.552800179, 4.43200016, 4.422699928, 4.392199993, 4.374599934, 4.327000141, 4.31099987, 4.3081002239999995, 4.308000088, 4.288599968, 4.187200069, 4.186200142, 4.165599823, 4.151400089, 3.926399946, 3.775300026, 3.759399891, 3.720799923, 3.6528000830000003, 3.573299885, 3.538000107, 3.5274000169999997, 3.4788999560000002, 3.4762001039999997, 3.475899935, 3.312299967, 3.2992000580000003, 2.8166000839999996, 2.566900015 ], "y0": " ", "yaxis": "y" } ], "layout": { "boxmode": "group", "legend": { "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Regional indicator" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "Happiness score" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = px.box(\n", " data_frame = df, \n", " x=\"Regional indicator\",\n", " y=\"Happiness score\")\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": { "papermill": { "duration": 0.016766, "end_time": "2020-12-11T00:27:33.156471", "exception": false, "start_time": "2020-12-11T00:27:33.139705", "status": "completed" }, "tags": [] }, "source": [ "As expected, while the happiest countries are in Western Europe there is a large variance in values, unlike North America and ANZ, which is more consistent. This is likely due to the fact that Western Europe covers a much larger number of countries.\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "papermill": { "duration": 0.016521, "end_time": "2020-12-11T00:27:33.190078", "exception": false, "start_time": "2020-12-11T00:27:33.173557", "status": "completed" }, "tags": [] }, "source": [ "## Correlation\n", "\n", "We can see from the graph below that the variables most important to happiness score are Log GDP per capita, Social Support and Healthy Life Expectancy, all of which are also very closely correlated. One possible explanation is that the log GDP per capita, leads to more funding for social support and for health care (i.e. improves life expectancy) , which explains why they are so closely related to each other.\n", "\n", "Interestingly generosity had almost no correlation with happiness score, nor with much with anything else." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "_kg_hide-input": true, "execution": { "iopub.execute_input": "2020-12-11T00:27:33.234738Z", "iopub.status.busy": "2020-12-11T00:27:33.232454Z", "iopub.status.idle": "2020-12-11T00:27:33.308077Z", "shell.execute_reply": "2020-12-11T00:27:33.308590Z" }, "papermill": { "duration": 0.101584, "end_time": "2020-12-11T00:27:33.308727", "exception": false, "start_time": "2020-12-11T00:27:33.207143", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "coloraxis": "coloraxis", "hovertemplate": "x: %{x}
y: %{y}
color: %{z}", "name": "0", "type": "heatmap", "x": [ "Explained by: Log GDP per capita", "Explained by: Social support", "Explained by: Healthy life expectancy", "Explained by: Freedom to make life choices", "Explained by: Generosity", "Explained by: Perceptions of corruption", "Dystopia + residual", "Happiness score" ], "xaxis": "x", "y": [ "Explained by: Log GDP per capita", "Explained by: Social support", "Explained by: Healthy life expectancy", "Explained by: Freedom to make life choices", "Explained by: Generosity", "Explained by: Perceptions of corruption", "Dystopia + residual", "Happiness score" ], "yaxis": "y", "z": [ [ 1, 0.7818135699994628, 0.8484686156419151, 0.41901865262372323, -0.11839938128213487, 0.3347290766833556, -0.06206306646797166, 0.7753743955405618 ], [ 0.7818135699994628, 1, 0.7427440817060499, 0.4788631792663906, -0.05678035879790661, 0.21052957939253475, -0.0028006909598605207, 0.7650007537905114 ], [ 0.8484686156419151, 0.7427440817060499, 1, 0.44884620183689244, -0.07185210507292357, 0.353841209037376, -0.03994777736240026, 0.7703162873347787 ], [ 0.41901865262372323, 0.4788631792663906, 0.44884620183689244, 1, 0.2537211339352375, 0.42014450469039605, 0.06257126846975307, 0.5905967935165652 ], [ -0.11839938128213487, -0.05678035879790661, -0.07185210507292357, 0.2537211339352375, 1, 0.27848021677316714, -0.021784938877391146, 0.06904312848601253 ], [ 0.3347290766833556, 0.21052957939253475, 0.353841209037376, 0.42014450469039605, 0.27848021677316714, 1, -0.0178509202745258, 0.41830508270159644 ], [ -0.06206306646797166, -0.0028006909598605207, -0.03994777736240026, 0.06257126846975307, -0.021784938877391146, -0.0178509202745258, 1, 0.48027894254283815 ], [ 0.7753743955405618, 0.7650007537905114, 0.7703162873347787, 0.5905967935165652, 0.06904312848601253, 0.41830508270159644, 0.48027894254283815, 1 ] ] } ], "layout": { "coloraxis": { "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Correlattion Map for 2020" }, "xaxis": { "anchor": "y", "constrain": "domain", "domain": [ 0, 1 ], "scaleanchor": "y" }, "yaxis": { "anchor": "x", "autorange": "reversed", "constrain": "domain", "domain": [ 0, 1 ] } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "cols = df[['Explained by: Log GDP per capita',\n", " 'Explained by: Social support',\n", " 'Explained by: Healthy life expectancy',\n", " 'Explained by: Freedom to make life choices',\n", " 'Explained by: Generosity',\n", " 'Explained by: Perceptions of corruption',\n", " 'Dystopia + residual',\n", " 'Happiness score']].corr()\n", "\n", "fig = px.imshow(cols,\n", " title = 'Correlattion Map for 2020')\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": { "papermill": { "duration": 0.01733, "end_time": "2020-12-11T00:27:33.343624", "exception": false, "start_time": "2020-12-11T00:27:33.326294", "status": "completed" }, "tags": [] }, "source": [ "# Trends\n", "\n", "We'll clean the data a little and then see the general trend over time, restricting our results to the previous 10 countries by default." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "_kg_hide-input": true, "execution": { "iopub.execute_input": "2020-12-11T00:27:33.402120Z", "iopub.status.busy": "2020-12-11T00:27:33.393062Z", "iopub.status.idle": "2020-12-11T00:27:33.509324Z", "shell.execute_reply": "2020-12-11T00:27:33.509915Z" }, "papermill": { "duration": 0.148968, "end_time": "2020-12-11T00:27:33.510056", "exception": false, "start_time": "2020-12-11T00:27:33.361088", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "## Add all the data to df from 2015 to 2020 \n", "df = []\n", "years = [\"2015\", \"2016\", \"2017\", \"2018\", \"2019\", \"2020\"]\n", "\n", "df.append(pd.read_csv(PATHS[0]))\n", "df[0][\"Year\"] = years[0]\n", "\n", "df.append(pd.read_csv(PATHS[1]))\n", "df[1][\"Year\"] = years[1]\n", "\n", "df.append(pd.read_csv(PATHS[2]))\n", "df[2][\"Year\"] = years[2]\n", "df[2].rename({\"Happiness.Score\": \"Happiness Score\"},axis=1, inplace=True)\n", "\n", "df.append(pd.read_csv(PATHS[3]))\n", "df[3][\"Year\"] = years[3]\n", "df[3].rename({\"Score\": \"Happiness Score\"},axis=1, inplace=True)\n", "df[3].rename({\"Country or region\": \"Country\"},axis=1, inplace=True)\n", "\n", "df.append(pd.read_csv(PATHS[4]))\n", "df[4][\"Year\"] = years[4]\n", "df[4].rename({\"Score\": \"Happiness Score\"},axis=1, inplace=True)\n", "df[4].rename({\"Country or region\": \"Country\"},axis=1, inplace=True)\n", "\n", "df.append(pd.read_csv(PATHS[5]))\n", "df[5][\"Year\"] = years[5]\n", "df[5].rename({\"Ladder score\": \"Happiness Score\"},axis=1, inplace=True)\n", "df[5].rename({\"Country name\": \"Country\"},axis=1, inplace=True)\n", " \n", "result = pd.concat(df)\n", "\n", "result = result.pivot(index = \"Year\", columns = \"Country\", values = \"Happiness Score\")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "_kg_hide-input": true, "execution": { "iopub.execute_input": "2020-12-11T00:27:33.553662Z", "iopub.status.busy": "2020-12-11T00:27:33.552997Z", "iopub.status.idle": "2020-12-11T00:27:35.309384Z", "shell.execute_reply": "2020-12-11T00:27:35.308759Z" }, "papermill": { "duration": 1.781003, "end_time": "2020-12-11T00:27:35.309493", "exception": false, "start_time": "2020-12-11T00:27:33.528490", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Country=Afghanistan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Afghanistan", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Afghanistan", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.575, 3.36, 3.7939999103546103, 3.6319999999999997, 3.2030000000000003, 2.566900015 ], "yaxis": "y" }, { "hovertemplate": "Country=Albania
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Albania", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Albania", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.959, 4.655, 4.64400005340576, 4.586, 4.718999999999999, 4.882699966000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Algeria
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Algeria", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Algeria", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.605, 6.355, 5.872000217437741, 5.295, 5.211, 5.005099773 ], "yaxis": "y" }, { "hovertemplate": "Country=Angola
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Angola", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Angola", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.033, 3.866, 3.79500007629395, 3.795, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Argentina
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Argentina", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Argentina", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.574, 6.65, 6.59899997711182, 6.388, 6.086, 5.974699974 ], "yaxis": "y" }, { "hovertemplate": "Country=Armenia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Armenia", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Armenia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.35, 4.36, 4.37599992752075, 4.321000000000001, 4.559, 4.676799774 ], "yaxis": "y" }, { "hovertemplate": "Country=Australia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Australia", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Australia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.284, 7.313, 7.28399991989136, 7.272, 7.228, 7.222799778 ], "yaxis": "y" }, { "hovertemplate": "Country=Austria
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Austria", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Austria", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.2, 7.119, 7.00600004196167, 7.138999999999999, 7.246, 7.294199944 ], "yaxis": "y" }, { "hovertemplate": "Country=Azerbaijan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Azerbaijan", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Azerbaijan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.212000000000001, 5.291, 5.234000205993651, 5.2010000000000005, 5.207999999999999, 5.164800167 ], "yaxis": "y" }, { "hovertemplate": "Country=Bahrain
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Bahrain", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Bahrain", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.96, 6.218, 6.08699989318848, 6.105, 6.199, 6.227300167 ], "yaxis": "y" }, { "hovertemplate": "Country=Bangladesh
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Bangladesh", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Bangladesh", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.694, 4.643, 4.60799980163574, 4.5, 4.456, 4.832799911 ], "yaxis": "y" }, { "hovertemplate": "Country=Belarus
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Belarus", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Belarus", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.813, 5.8020000000000005, 5.5689997673034695, 5.483, 5.3229999999999995, 5.539899826 ], "yaxis": "y" }, { "hovertemplate": "Country=Belgium
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Belgium", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Belgium", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.937, 6.928999999999999, 6.89099979400635, 6.9270000000000005, 6.922999999999999, 6.863500117999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Belize
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Belize", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Belize", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, 5.956, 5.955999851226809, 5.956, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Benin
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Benin", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Benin", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.34, 3.484, 3.65700006484985, 4.141, 4.883, 5.21600008 ], "yaxis": "y" }, { "hovertemplate": "Country=Bhutan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Bhutan", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Bhutan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.252999999999999, 5.196000000000001, 5.01100015640259, 5.082, 5.082, null ], "yaxis": "y" }, { "hovertemplate": "Country=Bolivia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Bolivia", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Bolivia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.89, 5.822, 5.82299995422363, 5.752000000000001, 5.779, 5.747499942999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Bosnia and Herzegovina
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Bosnia and Herzegovina", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Bosnia and Herzegovina", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.949, 5.162999999999999, 5.18200016021729, 5.129, 5.386, 5.674099922000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Botswana
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Botswana", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Botswana", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.332, 3.9739999999999998, 3.7660000324249303, 3.59, 3.488, 3.4788999560000002 ], "yaxis": "y" }, { "hovertemplate": "Country=Brazil
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Brazil", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Brazil", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.983, 6.952000000000001, 6.6350002288818395, 6.419, 6.3, 6.375599861 ], "yaxis": "y" }, { "hovertemplate": "Country=Bulgaria
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Bulgaria", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Bulgaria", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.218, 4.217, 4.71400022506714, 4.933, 5.011, 5.101500034 ], "yaxis": "y" }, { "hovertemplate": "Country=Burkina Faso
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Burkina Faso", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Burkina Faso", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.5869999999999997, 3.739, 4.03200006484985, 4.4239999999999995, 4.587, 4.768700123 ], "yaxis": "y" }, { "hovertemplate": "Country=Burundi
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Burundi", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Burundi", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 2.905, 2.905, 2.90499997138977, 2.905, 3.775, 3.775300026 ], "yaxis": "y" }, { "hovertemplate": "Country=Cambodia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Cambodia", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Cambodia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.819, 3.907, 4.1680002212524405, 4.433, 4.7, 4.8484001160000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Cameroon
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Cameroon", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Cameroon", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.252, 4.513, 4.69500017166138, 4.975, 5.044, 5.084899902 ], "yaxis": "y" }, { "hovertemplate": "Country=Canada
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Canada", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Canada", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.4270000000000005, 7.404, 7.31599998474121, 7.327999999999999, 7.278, 7.23210001 ], "yaxis": "y" }, { "hovertemplate": "Country=Central African Republic
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Central African Republic", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Central African Republic", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.678, null, 2.69300007820129, 3.083, 3.083, 3.475899935 ], "yaxis": "y" }, { "hovertemplate": "Country=Chad
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Chad", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Chad", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.667, 3.763, 3.9360001087188703, 4.301, 4.35, 4.422699928 ], "yaxis": "y" }, { "hovertemplate": "Country=Chile
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Chile", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Chile", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.67, 6.705, 6.65199995040894, 6.476, 6.444, 6.228499889 ], "yaxis": "y" }, { "hovertemplate": "Country=China
Year=%{x}
Happiness Score=%{y}", "legendgroup": "China", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "China", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.14, 5.245, 5.2729997634887695, 5.246, 5.191, 5.123899937 ], "yaxis": "y" }, { "hovertemplate": "Country=Colombia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Colombia", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Colombia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.477, 6.481, 6.35699987411499, 6.26, 6.125, 6.163400172999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Comoros
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Comoros", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Comoros", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.9560000000000004, 3.9560000000000004, null, null, 3.9730000000000003, 4.288599968 ], "yaxis": "y" }, { "hovertemplate": "Country=Congo (Brazzaville)
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Congo (Brazzaville)", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Congo (Brazzaville)", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.989, 4.236000000000001, 4.29099988937378, 4.559, 4.812, 5.1943998339999995 ], "yaxis": "y" }, { "hovertemplate": "Country=Congo (Kinshasa)
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Congo (Kinshasa)", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Congo (Kinshasa)", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.5169999999999995, 4.272, 4.2800002098083505, 4.245, 4.418, 4.31099987 ], "yaxis": "y" }, { "hovertemplate": "Country=Costa Rica
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Costa Rica", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Costa Rica", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.226, 7.087000000000001, 7.0789999961853, 7.072, 7.167000000000001, 7.121399879 ], "yaxis": "y" }, { "hovertemplate": "Country=Croatia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Croatia", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Croatia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.7589999999999995, 5.4879999999999995, 5.2930002212524405, 5.321000000000001, 5.432, 5.504700184 ], "yaxis": "y" }, { "hovertemplate": "Country=Cyprus
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Cyprus", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Cyprus", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.689, 5.546, 5.62099981307983, 5.7620000000000005, 6.046, 6.15899992 ], "yaxis": "y" }, { "hovertemplate": "Country=Czech Republic
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Czech Republic", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Czech Republic", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.505, 6.596, 6.60900020599365, 6.711, 6.852, 6.9109001160000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Denmark
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Denmark", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Denmark", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.527, 7.526, 7.52199983596802, 7.555, 7.6, 7.645599842 ], "yaxis": "y" }, { "hovertemplate": "Country=Djibouti
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Djibouti", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Djibouti", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.369, null, null, null, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Dominican Republic
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Dominican Republic", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Dominican Republic", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.885, 5.155, 5.230000019073491, 5.3020000000000005, 5.425, 5.6891999239999995 ], "yaxis": "y" }, { "hovertemplate": "Country=Ecuador
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Ecuador", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Ecuador", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.975, 5.976, 6.00799989700317, 5.973, 6.028, 5.925199986 ], "yaxis": "y" }, { "hovertemplate": "Country=Egypt
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Egypt", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Egypt", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.194, 4.362, 4.7350001335144, 4.419, 4.166, 4.151400089 ], "yaxis": "y" }, { "hovertemplate": "Country=El Salvador
Year=%{x}
Happiness Score=%{y}", "legendgroup": "El Salvador", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "El Salvador", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.13, 6.068, 6.002999782562259, 6.167000000000001, 6.252999999999999, 6.34829998 ], "yaxis": "y" }, { "hovertemplate": "Country=Estonia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Estonia", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Estonia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.428999999999999, 5.517, 5.61100006103516, 5.739, 5.893, 6.0218000410000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Ethiopia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Ethiopia", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Ethiopia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.512, 4.508, 4.46000003814697, 4.35, 4.2860000000000005, 4.186200142 ], "yaxis": "y" }, { "hovertemplate": "Country=Finland
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Finland", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Finland", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.406000000000001, 7.412999999999999, 7.468999862670901, 7.632000000000001, 7.769, 7.808700085 ], "yaxis": "y" }, { "hovertemplate": "Country=France
Year=%{x}
Happiness Score=%{y}", "legendgroup": "France", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "France", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.575, 6.478, 6.44199991226196, 6.489, 6.5920000000000005, 6.663799762999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Gabon
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Gabon", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Gabon", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.8960000000000004, 4.121, 4.46500015258789, 4.758, 4.7989999999999995, 4.829299927 ], "yaxis": "y" }, { "hovertemplate": "Country=Gambia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Gambia", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Gambia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, null, null, null, 4.516, 4.750599861 ], "yaxis": "y" }, { "hovertemplate": "Country=Georgia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Georgia", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Georgia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.297, 4.252, 4.28599977493286, 4.34, 4.519, 4.672599792 ], "yaxis": "y" }, { "hovertemplate": "Country=Germany
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Germany", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Germany", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.75, 6.994, 6.9510002136230495, 6.965, 6.985, 7.075799942000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Ghana
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Ghana", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Ghana", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.633, 4.276, 4.11999988555908, 4.657, 4.996, 5.1479997630000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Greece
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Greece", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Greece", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.857, 5.033, 5.2270002365112305, 5.358, 5.287000000000001, 5.514999866 ], "yaxis": "y" }, { "hovertemplate": "Country=Guatemala
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Guatemala", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Guatemala", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.122999999999999, 6.324, 6.4539999961853, 6.382000000000001, 6.436, 6.398900032 ], "yaxis": "y" }, { "hovertemplate": "Country=Guinea
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Guinea", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Guinea", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.656, 3.6069999999999998, 3.50699996948242, 3.964, 4.534, 4.949299812 ], "yaxis": "y" }, { "hovertemplate": "Country=Haiti
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Haiti", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Haiti", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.518, 4.0280000000000005, 3.6029999256133998, 3.582, 3.597, 3.720799923 ], "yaxis": "y" }, { "hovertemplate": "Country=Honduras
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Honduras", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Honduras", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.788, 4.871, 5.1810002326965305, 5.504, 5.86, 5.953199862999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Hong Kong
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Hong Kong", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Hong Kong", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.474, 5.457999999999999, null, 5.43, 5.43, null ], "yaxis": "y" }, { "hovertemplate": "Country=Hong Kong S.A.R. of China
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Hong Kong S.A.R. of China", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Hong Kong S.A.R. of China", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, null, null, null, null, 5.510399818 ], "yaxis": "y" }, { "hovertemplate": "Country=Hong Kong S.A.R., China
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Hong Kong S.A.R., China", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Hong Kong S.A.R., China", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, null, 5.47200012207031, null, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Hungary
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Hungary", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Hungary", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.8, 5.145, 5.32399988174438, 5.62, 5.757999999999999, 6.000400066 ], "yaxis": "y" }, { "hovertemplate": "Country=Iceland
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Iceland", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Iceland", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.561, 7.501, 7.50400018692017, 7.495, 7.494, 7.504499912000001 ], "yaxis": "y" }, { "hovertemplate": "Country=India
Year=%{x}
Happiness Score=%{y}", "legendgroup": "India", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "India", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.565, 4.404, 4.31500005722046, 4.19, 4.015, 3.573299885 ], "yaxis": "y" }, { "hovertemplate": "Country=Indonesia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Indonesia", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Indonesia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.399, 5.314, 5.26200008392334, 5.093, 5.192, 5.285600185 ], "yaxis": "y" }, { "hovertemplate": "Country=Iran
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Iran", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Iran", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.686, 4.813, 4.69199991226196, 4.707, 4.548, 4.672399998 ], "yaxis": "y" }, { "hovertemplate": "Country=Iraq
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Iraq", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Iraq", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.677, 4.575, 4.49700021743774, 4.456, 4.437, 4.7848000530000006 ], "yaxis": "y" }, { "hovertemplate": "Country=Ireland
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Ireland", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Ireland", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.94, 6.907, 6.9770002365112305, 6.977, 7.021, 7.093699932000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Israel
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Israel", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Israel", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.278, 7.267, 7.212999820709231, 6.814, 7.138999999999999, 7.128600121 ], "yaxis": "y" }, { "hovertemplate": "Country=Italy
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Italy", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Italy", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.9479999999999995, 5.977, 5.96400022506714, 6, 6.223, 6.38740015 ], "yaxis": "y" }, { "hovertemplate": "Country=Ivory Coast
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Ivory Coast", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Ivory Coast", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.655, 3.9160000000000004, 4.17999982833862, 4.671, 4.944, 5.233300208999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Jamaica
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Jamaica", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Jamaica", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.709, 5.51, 5.31099987030029, 5.89, 5.89, 5.889800072000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Japan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Japan", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Japan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.987, 5.921, 5.92000007629395, 5.915, 5.886, 5.870800018 ], "yaxis": "y" }, { "hovertemplate": "Country=Jordan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Jordan", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Jordan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.192, 5.303, 5.33599996566772, 5.1610000000000005, 4.906000000000001, 4.6333999630000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Kazakhstan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Kazakhstan", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Kazakhstan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.855, 5.919, 5.8189997673034695, 5.79, 5.809, 6.0578999520000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Kenya
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Kenya", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Kenya", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.419, 4.356, 4.55299997329712, 4.41, 4.5089999999999995, 4.583000183 ], "yaxis": "y" }, { "hovertemplate": "Country=Kosovo
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Kosovo", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Kosovo", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.5889999999999995, 5.401, 5.27899980545044, 5.662000000000001, 6.1, 6.325200081 ], "yaxis": "y" }, { "hovertemplate": "Country=Kuwait
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Kuwait", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Kuwait", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.295, 6.239, 6.10500001907349, 6.082999999999999, 6.021, 6.102099895 ], "yaxis": "y" }, { "hovertemplate": "Country=Kyrgyzstan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Kyrgyzstan", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Kyrgyzstan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.2860000000000005, 5.185, 5.0040001869201705, 5.131, 5.261, 5.541500092000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Laos
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Laos", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Laos", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.876, 4.876, null, 4.623, 4.796, 4.888599873 ], "yaxis": "y" }, { "hovertemplate": "Country=Latvia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Latvia", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Latvia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.098, 5.56, 5.849999904632571, 5.933, 5.94, 5.9499998089999995 ], "yaxis": "y" }, { "hovertemplate": "Country=Lebanon
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Lebanon", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Lebanon", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.8389999999999995, 5.129, 5.22499990463257, 5.358, 5.197, 4.771500111 ], "yaxis": "y" }, { "hovertemplate": "Country=Lesotho
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Lesotho", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Lesotho", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.898, null, 3.80800008773804, 3.8080000000000003, 3.802, 3.6528000830000003 ], "yaxis": "y" }, { "hovertemplate": "Country=Liberia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Liberia", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Liberia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.571000000000001, 3.622, 3.5329999923706095, 3.495, 3.975, 4.557899952 ], "yaxis": "y" }, { "hovertemplate": "Country=Libya
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Libya", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Libya", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.754, 5.615, 5.525000095367429, 5.566, 5.525, 5.488800049 ], "yaxis": "y" }, { "hovertemplate": "Country=Lithuania
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Lithuania", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Lithuania", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.832999999999999, 5.813, 5.90199995040894, 5.952000000000001, 6.149, 6.215499877999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Luxembourg
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Luxembourg", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Luxembourg", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.946000000000001, 6.871, 6.86299991607666, 6.91, 7.09, 7.2375001910000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Macedonia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Macedonia", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Macedonia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.007, 5.121, 5.175000190734861, 5.185, null, 5.1598000530000006 ], "yaxis": "y" }, { "hovertemplate": "Country=Madagascar
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Madagascar", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Madagascar", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.681, 3.695, 3.64400005340576, 3.7739999999999996, 3.9330000000000003, 4.165599823 ], "yaxis": "y" }, { "hovertemplate": "Country=Malawi
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Malawi", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Malawi", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.292, 4.156000000000001, 3.97000002861023, 3.5869999999999997, 3.41, 3.538000107 ], "yaxis": "y" }, { "hovertemplate": "Country=Malaysia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Malaysia", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Malaysia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.77, 6.005, 6.08400011062622, 6.322, 5.3389999999999995, 5.384300232 ], "yaxis": "y" }, { "hovertemplate": "Country=Maldives
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Maldives", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Maldives", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, null, null, null, null, 5.197599888 ], "yaxis": "y" }, { "hovertemplate": "Country=Mali
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Mali", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Mali", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.995, 4.073, 4.19000005722046, 4.447, 4.39, 4.729300021999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Malta
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Malta", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Malta", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.3020000000000005, 6.4879999999999995, 6.52699995040894, 6.627000000000001, 6.726, 6.772799968999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Mauritania
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Mauritania", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Mauritania", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.436, 4.2010000000000005, 4.29199981689453, 4.356, 4.49, 4.374599934 ], "yaxis": "y" }, { "hovertemplate": "Country=Mauritius
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Mauritius", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Mauritius", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.477, 5.648, 5.62900018692017, 5.891, 5.888, 6.101299762999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Mexico
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Mexico", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Mexico", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.187, 6.778, 6.57800006866455, 6.4879999999999995, 6.595, 6.465000152999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Moldova
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Moldova", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Moldova", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.888999999999999, 5.897, 5.837999820709231, 5.64, 5.529, 5.607500076 ], "yaxis": "y" }, { "hovertemplate": "Country=Mongolia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Mongolia", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Mongolia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.874, 4.907, 4.95499992370605, 5.125, 5.285, 5.4562001229999995 ], "yaxis": "y" }, { "hovertemplate": "Country=Montenegro
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Montenegro", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Montenegro", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.192, 5.1610000000000005, 5.23699998855591, 5.347, 5.523, 5.54610014 ], "yaxis": "y" }, { "hovertemplate": "Country=Morocco
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Morocco", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Morocco", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.013, 5.151, 5.2350001335144, 5.254, 5.207999999999999, 5.094799995 ], "yaxis": "y" }, { "hovertemplate": "Country=Mozambique
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Mozambique", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Mozambique", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.971, null, 4.550000190734861, 4.417, 4.466, 4.623600006 ], "yaxis": "y" }, { "hovertemplate": "Country=Myanmar
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Myanmar", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Myanmar", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.3069999999999995, 4.395, 4.54500007629395, 4.308, 4.36, 4.308000088 ], "yaxis": "y" }, { "hovertemplate": "Country=Namibia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Namibia", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Namibia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, 4.574, 4.57399988174438, 4.441, 4.638999999999999, 4.571100235 ], "yaxis": "y" }, { "hovertemplate": "Country=Nepal
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Nepal", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Nepal", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.513999999999999, 4.793, 4.961999893188481, 4.88, 4.913, 5.137199879 ], "yaxis": "y" }, { "hovertemplate": "Country=Netherlands
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Netherlands", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Netherlands", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.377999999999999, 7.3389999999999995, 7.3769998550415, 7.441, 7.4879999999999995, 7.448900223 ], "yaxis": "y" }, { "hovertemplate": "Country=New Zealand
Year=%{x}
Happiness Score=%{y}", "legendgroup": "New Zealand", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "New Zealand", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.2860000000000005, 7.334, 7.31400012969971, 7.324, 7.307, 7.2996001239999995 ], "yaxis": "y" }, { "hovertemplate": "Country=Nicaragua
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Nicaragua", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Nicaragua", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.827999999999999, 5.992000000000001, 6.07100009918213, 6.141, 6.105, 6.13710022 ], "yaxis": "y" }, { "hovertemplate": "Country=Niger
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Niger", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Niger", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.845, 3.8560000000000003, 4.02799987792969, 4.166, 4.628, 4.909599781 ], "yaxis": "y" }, { "hovertemplate": "Country=Nigeria
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Nigeria", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Nigeria", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.268, 4.875, 5.07399988174438, 5.155, 5.265, 4.724100113 ], "yaxis": "y" }, { "hovertemplate": "Country=North Cyprus
Year=%{x}
Happiness Score=%{y}", "legendgroup": "North Cyprus", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "North Cyprus", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.695, 5.771, 5.80999994277954, null, null, 5.53550005 ], "yaxis": "y" }, { "hovertemplate": "Country=North Macedonia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "North Macedonia", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "North Macedonia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, null, null, null, 5.274, null ], "yaxis": "y" }, { "hovertemplate": "Country=Northern Cyprus
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Northern Cyprus", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Northern Cyprus", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, null, null, 5.835, 5.718, null ], "yaxis": "y" }, { "hovertemplate": "Country=Norway
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Norway", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Norway", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.522, 7.497999999999999, 7.537000179290769, 7.593999999999999, 7.553999999999999, 7.487999916000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Oman
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Oman", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Oman", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.853, null, null, null, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Pakistan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Pakistan", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Pakistan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.194, 5.132000000000001, 5.26900005340576, 5.472, 5.653, 5.69329977 ], "yaxis": "y" }, { "hovertemplate": "Country=Palestinian Territories
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Palestinian Territories", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Palestinian Territories", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.715, 4.754, 4.77500009536743, 4.743, 4.696000000000001, 4.552800179 ], "yaxis": "y" }, { "hovertemplate": "Country=Panama
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Panama", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Panama", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.7860000000000005, 6.7010000000000005, 6.4520001411438, 6.43, 6.321000000000001, 6.304800033999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Paraguay
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Paraguay", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Paraguay", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.877999999999999, 5.537999999999999, 5.493000030517581, 5.681, 5.742999999999999, 5.6921000479999995 ], "yaxis": "y" }, { "hovertemplate": "Country=Peru
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Peru", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Peru", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.824, 5.742999999999999, 5.71500015258789, 5.662999999999999, 5.697, 5.796800137000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Philippines
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Philippines", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Philippines", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.073, 5.279, 5.42999982833862, 5.524, 5.631, 6.006000042 ], "yaxis": "y" }, { "hovertemplate": "Country=Poland
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Poland", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Poland", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.791, 5.835, 5.97300004959106, 6.122999999999999, 6.182, 6.1862998010000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Portugal
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Portugal", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Portugal", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.102, 5.122999999999999, 5.19500017166138, 5.41, 5.693, 5.9109001160000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Puerto Rico
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Puerto Rico", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Puerto Rico", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, 7.039, null, null, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Qatar
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Qatar", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Qatar", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.611000000000001, 6.375, 6.375, 6.374, 6.374, null ], "yaxis": "y" }, { "hovertemplate": "Country=Romania
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Romania", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Romania", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.124, 5.528, 5.824999809265139, 5.945, 6.07, 6.123700142000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Russia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Russia", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Russia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.716, 5.856, 5.962999820709231, 5.81, 5.648, 5.546000004 ], "yaxis": "y" }, { "hovertemplate": "Country=Rwanda
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Rwanda", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Rwanda", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.465, 3.515, 3.47099995613098, 3.408, 3.3339999999999996, 3.312299967 ], "yaxis": "y" }, { "hovertemplate": "Country=Saudi Arabia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Saudi Arabia", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Saudi Arabia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.4110000000000005, 6.379, 6.343999862670901, 6.371, 6.375, 6.406499863 ], "yaxis": "y" }, { "hovertemplate": "Country=Senegal
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Senegal", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Senegal", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.904, 4.218999999999999, 4.53499984741211, 4.631, 4.681, 4.980800152 ], "yaxis": "y" }, { "hovertemplate": "Country=Serbia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Serbia", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Serbia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.122999999999999, 5.1770000000000005, 5.39499998092651, 5.398, 5.603, 5.77820015 ], "yaxis": "y" }, { "hovertemplate": "Country=Sierra Leone
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Sierra Leone", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Sierra Leone", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.507, 4.635, 4.70900011062622, 4.571000000000001, 4.374, 3.926399946 ], "yaxis": "y" }, { "hovertemplate": "Country=Singapore
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Singapore", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Singapore", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.797999999999999, 6.739, 6.57200002670288, 6.343, 6.2620000000000005, 6.377099991000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Slovakia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Slovakia", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Slovakia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.995, 6.077999999999999, 6.09800004959106, 6.172999999999999, 6.1979999999999995, 6.280600071 ], "yaxis": "y" }, { "hovertemplate": "Country=Slovenia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Slovenia", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Slovenia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.848, 5.768, 5.75799989700317, 5.9479999999999995, 6.117999999999999, 6.363399982000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Somalia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Somalia", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Somalia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, 5.44, 5.151000022888179, 4.982, 4.668, null ], "yaxis": "y" }, { "hovertemplate": "Country=Somaliland Region
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Somaliland Region", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Somaliland Region", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, 5.0569999999999995, null, null, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Somaliland region
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Somaliland region", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Somaliland region", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.0569999999999995, null, null, null, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=South Africa
Year=%{x}
Happiness Score=%{y}", "legendgroup": "South Africa", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "South Africa", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.6419999999999995, 4.459, 4.8289999961853, 4.724, 4.7219999999999995, 4.814099789 ], "yaxis": "y" }, { "hovertemplate": "Country=South Korea
Year=%{x}
Happiness Score=%{y}", "legendgroup": "South Korea", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "South Korea", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.984, 5.835, 5.837999820709231, 5.875, 5.895, 5.872399807000001 ], "yaxis": "y" }, { "hovertemplate": "Country=South Sudan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "South Sudan", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "South Sudan", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, 3.832, 3.5910000801086404, 3.2539999999999996, 2.853, 2.8166000839999996 ], "yaxis": "y" }, { "hovertemplate": "Country=Spain
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Spain", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Spain", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.329, 6.361000000000001, 6.40299987792969, 6.31, 6.354, 6.4008998870000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Sri Lanka
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Sri Lanka", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Sri Lanka", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.271, 4.415, 4.44000005722046, 4.471, 4.3660000000000005, 4.327000141 ], "yaxis": "y" }, { "hovertemplate": "Country=Sudan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Sudan", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Sudan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.55, 4.138999999999999, 4.138999938964839, 4.138999999999999, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Suriname
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Suriname", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Suriname", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.269, 6.269, null, null, null, null ], "yaxis": "y" }, { "hovertemplate": "Country=Swaziland
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Swaziland", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Swaziland", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.867, null, null, null, 4.212, 4.3081002239999995 ], "yaxis": "y" }, { "hovertemplate": "Country=Sweden
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Sweden", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Sweden", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.364, 7.291, 7.28399991989136, 7.314, 7.343, 7.353499889 ], "yaxis": "y" }, { "hovertemplate": "Country=Switzerland
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Switzerland", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Switzerland", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.587000000000001, 7.5089999999999995, 7.49399995803833, 7.487, 7.48, 7.559899807000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Syria
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Syria", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Syria", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.0060000000000002, 3.069, 3.46199989318848, 3.4619999999999997, 3.4619999999999997, null ], "yaxis": "y" }, { "hovertemplate": "Country=Taiwan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Taiwan", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Taiwan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.297999999999999, 6.379, null, 6.441, 6.446000000000001, null ], "yaxis": "y" }, { "hovertemplate": "Country=Taiwan Province of China
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Taiwan Province of China", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Taiwan Province of China", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, null, 6.42199993133545, null, null, 6.45539999 ], "yaxis": "y" }, { "hovertemplate": "Country=Tajikistan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Tajikistan", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Tajikistan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.7860000000000005, 4.996, 5.04099988937378, 5.199, 5.4670000000000005, 5.555699825 ], "yaxis": "y" }, { "hovertemplate": "Country=Tanzania
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Tanzania", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "Tanzania", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.781, 3.6660000000000004, 3.34899997711182, 3.303, 3.2310000000000003, 3.4762001039999997 ], "yaxis": "y" }, { "hovertemplate": "Country=Thailand
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Thailand", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "Thailand", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.455, 6.474, 6.4239997863769505, 6.072, 6.007999999999999, 5.9987998010000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Togo
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Togo", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "Togo", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 2.839, 3.303, 3.4949998855590803, 3.9989999999999997, 4.085, 4.187200069 ], "yaxis": "y" }, { "hovertemplate": "Country=Trinidad & Tobago
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Trinidad & Tobago", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Trinidad & Tobago", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ null, null, null, 6.192, 6.192, null ], "yaxis": "y" }, { "hovertemplate": "Country=Trinidad and Tobago
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Trinidad and Tobago", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Trinidad and Tobago", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.167999999999999, 6.167999999999999, 6.1680002212524405, null, null, 6.1918997760000005 ], "yaxis": "y" }, { "hovertemplate": "Country=Tunisia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Tunisia", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Tunisia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.739, 5.045, 4.80499982833862, 4.592, 4.461, 4.392199993 ], "yaxis": "y" }, { "hovertemplate": "Country=Turkey
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Turkey", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Turkey", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.332000000000001, 5.388999999999999, 5.5, 5.483, 5.372999999999999, 5.131800175 ], "yaxis": "y" }, { "hovertemplate": "Country=Turkmenistan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Turkmenistan", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Turkmenistan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.547999999999999, 5.6579999999999995, 5.82200002670288, 5.636, 5.247000000000001, 5.119100093999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Uganda
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Uganda", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Uganda", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 3.931, 3.739, 4.08099985122681, 4.1610000000000005, 4.189, 4.43200016 ], "yaxis": "y" }, { "hovertemplate": "Country=Ukraine
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Ukraine", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Ukraine", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.681, 4.324, 4.09600019454956, 4.103, 4.332, 4.56069994 ], "yaxis": "y" }, { "hovertemplate": "Country=United Arab Emirates
Year=%{x}
Happiness Score=%{y}", "legendgroup": "United Arab Emirates", "line": { "color": "#00cc96", "dash": "solid" }, "mode": "lines", "name": "United Arab Emirates", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.901, 6.5729999999999995, 6.6479997634887695, 6.774, 6.825, 6.790800095 ], "yaxis": "y" }, { "hovertemplate": "Country=United Kingdom
Year=%{x}
Happiness Score=%{y}", "legendgroup": "United Kingdom", "line": { "color": "#ab63fa", "dash": "solid" }, "mode": "lines", "name": "United Kingdom", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.867000000000001, 6.725, 6.71400022506714, 7.19, 7.053999999999999, 7.164500237 ], "yaxis": "y" }, { "hovertemplate": "Country=United States
Year=%{x}
Happiness Score=%{y}", "legendgroup": "United States", "line": { "color": "#FFA15A", "dash": "solid" }, "mode": "lines", "name": "United States", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 7.119, 7.104, 6.993000030517581, 6.886, 6.892, 6.939599991000001 ], "yaxis": "y" }, { "hovertemplate": "Country=Uruguay
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Uruguay", "line": { "color": "#19d3f3", "dash": "solid" }, "mode": "lines", "name": "Uruguay", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.485, 6.545, 6.4539999961853, 6.379, 6.292999999999999, 6.440100192999999 ], "yaxis": "y" }, { "hovertemplate": "Country=Uzbekistan
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Uzbekistan", "line": { "color": "#FF6692", "dash": "solid" }, "mode": "lines", "name": "Uzbekistan", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.002999999999999, 5.987, 5.97100019454956, 6.096, 6.1739999999999995, 6.257599831 ], "yaxis": "y" }, { "hovertemplate": "Country=Venezuela
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Venezuela", "line": { "color": "#B6E880", "dash": "solid" }, "mode": "lines", "name": "Venezuela", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 6.81, 6.084, 5.25, 4.806, 4.707, 5.053199768 ], "yaxis": "y" }, { "hovertemplate": "Country=Vietnam
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Vietnam", "line": { "color": "#FF97FF", "dash": "solid" }, "mode": "lines", "name": "Vietnam", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.36, 5.061, 5.07399988174438, 5.103, 5.175, 5.353499889 ], "yaxis": "y" }, { "hovertemplate": "Country=Yemen
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Yemen", "line": { "color": "#FECB52", "dash": "solid" }, "mode": "lines", "name": "Yemen", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.077, 3.7239999999999998, 3.59299993515015, 3.355, 3.38, 3.5274000169999997 ], "yaxis": "y" }, { "hovertemplate": "Country=Zambia
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Zambia", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Zambia", "showlegend": true, "type": "scattergl", "visible": "legendonly", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.129, 4.795, 4.513999938964839, 4.377, 4.107, 3.759399891 ], "yaxis": "y" }, { "hovertemplate": "Country=Zimbabwe
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Zimbabwe", "line": { "color": "#EF553B", "dash": "solid" }, "mode": "lines", "name": "Zimbabwe", "showlegend": true, "type": "scattergl", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 4.61, 4.1930000000000005, 3.875, 3.6919999999999997, 3.6630000000000003, 3.2992000580000003 ], "yaxis": "y" } ], "layout": { "legend": { "title": { "text": "Country" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Happiness Score of Countries over time." }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Year" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "Happiness Score" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "countries_list = [\"Finland\", \"Denmark\", \"Switzerland\", \"Iceland\", \"Norway\", \"Afghanistan\", \"South Sudan\", \"Zimbabwe\", \"Rwanda\", \"Central African Republic\"]\n", "fig = px.line(result,\n", " #x = \"Year\",\n", " #y = \"Happiness Score\",\n", " title = \"Happiness Score of Countries over time.\",\n", " labels = {\"value\":\"Happiness Score\"})\n", "\n", "fig.for_each_trace(lambda trace: trace.update(visible=\"legendonly\") \n", " if trace.name not in countries_list else ())\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": { "papermill": { "duration": 0.021321, "end_time": "2020-12-11T00:27:35.351435", "exception": false, "start_time": "2020-12-11T00:27:35.330114", "status": "completed" }, "tags": [] }, "source": [ "The top countries appear to be increasing very slowly. On the other hand it's concerning to see that the worst countries are rapidly dropping in score.\n", "\n", "We also see below that the mean world happiness is increasing, although very slowly and likely below significance." ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "_kg_hide-input": true, "execution": { "iopub.execute_input": "2020-12-11T00:27:35.410739Z", "iopub.status.busy": "2020-12-11T00:27:35.404171Z", "iopub.status.idle": "2020-12-11T00:27:35.501717Z", "shell.execute_reply": "2020-12-11T00:27:35.502396Z" }, "papermill": { "duration": 0.130562, "end_time": "2020-12-11T00:27:35.502559", "exception": false, "start_time": "2020-12-11T00:27:35.371997", "status": "completed" }, "tags": [] }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "variable=Mean
Year=%{x}
Happiness Score=%{y}", "legendgroup": "Mean", "line": { "color": "#636efa", "dash": "solid" }, "mode": "lines", "name": "Mean", "orientation": "v", "showlegend": true, "type": "scatter", "x": [ "2015", "2016", "2017", "2018", "2019", "2020" ], "xaxis": "x", "y": [ 5.37573417721519, 5.382184713375795, 5.354019355773926, 5.375916666666667, 5.407096153846154, 5.473239862849673 ], "yaxis": "y" } ], "layout": { "legend": { "title": { "text": "variable" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "World Average(Mean) Trend" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Year" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "Happiness Score" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "result = pd.concat(df)\n", "result = result.pivot(index = \"Year\", columns = \"Country\", values = \"Happiness Score\")\n", "result[\"Mean\"] = result.mean(axis=1)\n", "\n", "#print(result.head())\n", "#print(result[\"Mean\"])\n", "\n", "fig = px.line(result[\"Mean\"],\n", " title = \"World Average(Mean) Trend\",\n", " labels = {\"value\":\"Happiness Score\"})\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Conclusion\n", "\n", "To conclude we have discovered which countries are the most and least happy, and tracked these down to the most correlated features. We have also identified the spread of this score across regions, and discussed the trends in the last 5 years of data. \n", "\n", "In the future I hope to append additional data to these databases and try to predict happiness scores from these. In particular I am interested in the effect education levels and types have on a countries happiness and how it correlates to the features in the data here." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.0" }, "papermill": { "duration": 10.957198, "end_time": "2020-12-11T00:27:35.640278", "environment_variables": {}, "exception": null, "input_path": "__notebook__.ipynb", "output_path": "__notebook__.ipynb", "parameters": {}, "start_time": "2020-12-11T00:27:24.683080", "version": "2.1.0" } }, "nbformat": 4, "nbformat_minor": 4 }