Spaces:
Sleeping
Sleeping
add files
Browse files- Introduction.py +9 -0
- README.md +2 -2
- data/create_regional_dataset.ipynb +386 -0
- data/eu_region_data.csv +243 -0
- pages/2_Analyses.py +99 -0
- requirements.txt +10 -0
- stat_mod/__init__.py +6 -0
- stat_mod/__pycache__/__init__.cpython-38.pyc +0 -0
- stat_mod/__pycache__/data_opt.cpython-38.pyc +0 -0
- stat_mod/__pycache__/datasets.cpython-38.pyc +0 -0
- stat_mod/__pycache__/definitions.cpython-38.pyc +0 -0
- stat_mod/__pycache__/figure.cpython-38.pyc +0 -0
- stat_mod/__pycache__/figures.cpython-38.pyc +0 -0
- stat_mod/__pycache__/nuts2.cpython-38.pyc +0 -0
- stat_mod/__pycache__/options.cpython-38.pyc +0 -0
- stat_mod/__pycache__/text.cpython-38.pyc +0 -0
- stat_mod/__pycache__/text_elements.cpython-38.pyc +0 -0
- stat_mod/__pycache__/util_funcs.cpython-38.pyc +0 -0
- stat_mod/__pycache__/utils.cpython-38.pyc +0 -0
- stat_mod/definitions.py +480 -0
- stat_mod/figures.py +96 -0
- stat_mod/text.py +10 -0
Introduction.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from streamlit import session_state as session
|
3 |
+
|
4 |
+
from stat_mod import *
|
5 |
+
|
6 |
+
st.set_page_config(page_title="EU Data Explorer📊", page_icon="📊")
|
7 |
+
|
8 |
+
st.title("EU Data Explorer📊")
|
9 |
+
st.markdown(intro_text, unsafe_allow_html=True)
|
README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
---
|
2 |
title: Eudataexplorer
|
3 |
-
emoji:
|
4 |
colorFrom: green
|
5 |
colorTo: gray
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.17.0
|
8 |
-
app_file:
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
---
|
|
|
1 |
---
|
2 |
title: Eudataexplorer
|
3 |
+
emoji: 📈
|
4 |
colorFrom: green
|
5 |
colorTo: gray
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.17.0
|
8 |
+
app_file: Introduction.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
---
|
data/create_regional_dataset.ipynb
ADDED
@@ -0,0 +1,386 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"attachments": {},
|
5 |
+
"cell_type": "markdown",
|
6 |
+
"id": "bc9fba0f",
|
7 |
+
"metadata": {},
|
8 |
+
"source": [
|
9 |
+
"# DataFrame for EU regional data"
|
10 |
+
]
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"cell_type": "code",
|
14 |
+
"execution_count": null,
|
15 |
+
"id": "0e470150",
|
16 |
+
"metadata": {},
|
17 |
+
"outputs": [],
|
18 |
+
"source": [
|
19 |
+
"import os, sys\n",
|
20 |
+
"sys.path.insert(1, os.path.abspath('..'))\n",
|
21 |
+
"\n",
|
22 |
+
"from stat_mod import *\n",
|
23 |
+
"import seaborn as sns\n",
|
24 |
+
"import matplotlib.pyplot as plt"
|
25 |
+
]
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"cell_type": "code",
|
29 |
+
"execution_count": 2,
|
30 |
+
"id": "b380d28d-7e6e-4f5b-82e3-e1d9d2ec214a",
|
31 |
+
"metadata": {},
|
32 |
+
"outputs": [],
|
33 |
+
"source": [
|
34 |
+
"# Create dicts with EU NUTS 2 regions\n",
|
35 |
+
"eu_regions = { 'AT': 'Western Europe',\n",
|
36 |
+
"'BE': 'Western Europe', 'FR': 'Western Europe', 'DE': 'Western Europe',\n",
|
37 |
+
"'IE': 'Western Europe', 'LU': 'Western Europe', 'NL': 'Western Europe',\n",
|
38 |
+
"'CY': 'Southern Europe', 'EL': 'Southern Europe', 'IT': 'Southern Europe',\n",
|
39 |
+
"'MT': 'Southern Europe', 'PT': 'Southern Europe', 'ES': 'Southern Europe',\n",
|
40 |
+
"'DK': 'Northern Europe', 'EE': 'Northern Europe', 'FI': 'Northern Europe',\n",
|
41 |
+
"'LV': 'Northern Europe', 'LT': 'Northern Europe', 'SE': 'Northern Europe',\n",
|
42 |
+
"'BG': 'Central and Eastern Europe', 'HR': 'Central and Eastern Europe',\n",
|
43 |
+
"'CZ': 'Central and Eastern Europe', 'RO': 'Central and Eastern Europe',\n",
|
44 |
+
"'SK': 'Central and Eastern Europe', 'SI': 'Central and Eastern Europe',\n",
|
45 |
+
"'PL': 'Central and Eastern Europe', 'HU': 'Central and Eastern Europe' }\n",
|
46 |
+
"\n",
|
47 |
+
"regions = {}\n",
|
48 |
+
"for item in countries.values():\n",
|
49 |
+
" regions.update(nuts_codes[item])"
|
50 |
+
]
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"cell_type": "code",
|
54 |
+
"execution_count": 3,
|
55 |
+
"id": "dd5d63ab-9317-4aa0-a366-7f412cfd4cf4",
|
56 |
+
"metadata": {},
|
57 |
+
"outputs": [],
|
58 |
+
"source": [
|
59 |
+
"# Regional \"GDP\"\n",
|
60 |
+
"def get_gdp_region():\n",
|
61 |
+
" params = {'unit': 'MIO_EUR', 'geo': list(regions.keys()), 'time': 2020}\n",
|
62 |
+
" df = client.get_dataset('nama_10r_2gdp', params).to_dataframe()\n",
|
63 |
+
" \n",
|
64 |
+
" # Remove NAs\n",
|
65 |
+
" df.dropna(inplace = True)\n",
|
66 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
67 |
+
" df['Country'] = df['geo'].str[:2]\n",
|
68 |
+
" df['EU Region'] = df['Country'].apply(lambda x: eu_regions[x])\n",
|
69 |
+
" df.set_index('region_name', inplace=True) \n",
|
70 |
+
" df.rename(columns = {'values': 'GDP'}, inplace = True)\n",
|
71 |
+
" df['GDP'] = df['GDP'] / 1000\n",
|
72 |
+
" cols = ['Country', 'EU Region', 'GDP',]\n",
|
73 |
+
" \n",
|
74 |
+
" return df[cols]"
|
75 |
+
]
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"cell_type": "code",
|
79 |
+
"execution_count": 4,
|
80 |
+
"id": "ff71efcc-e4a6-4dce-9881-f431ddda628f",
|
81 |
+
"metadata": {},
|
82 |
+
"outputs": [],
|
83 |
+
"source": [
|
84 |
+
"# Regional \"GDP\" per capita\n",
|
85 |
+
"def get_gdp_capita_region():\n",
|
86 |
+
" params = {'unit': 'EUR_HAB', 'time': 2020,\n",
|
87 |
+
" 'geo': list(regions.keys())}\n",
|
88 |
+
" df = client.get_dataset('nama_10r_2gdp', params).to_dataframe()\n",
|
89 |
+
"\n",
|
90 |
+
" # Remove NAs\n",
|
91 |
+
" df.dropna(inplace = True)\n",
|
92 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
93 |
+
" df.set_index('region_name', inplace=True) \n",
|
94 |
+
" df.rename(columns = {'values': 'GDP per Capita'}, inplace = True)\n",
|
95 |
+
" df = df[['GDP per Capita']]\n",
|
96 |
+
" \n",
|
97 |
+
" return df"
|
98 |
+
]
|
99 |
+
},
|
100 |
+
{
|
101 |
+
"cell_type": "code",
|
102 |
+
"execution_count": 5,
|
103 |
+
"id": "7c9a96ad-052a-49b0-b364-cea1adb39312",
|
104 |
+
"metadata": {},
|
105 |
+
"outputs": [],
|
106 |
+
"source": [
|
107 |
+
"# Regional unemployment\n",
|
108 |
+
"def get_unemployment_region():\n",
|
109 |
+
" params = {'sex': 'T', 'geo': list(regions.keys()), 'time': 2021,\n",
|
110 |
+
" 'age': 'Y15-74', 'isced11': 'TOTAL'} \n",
|
111 |
+
" df = client.get_dataset('lfst_r_lfu3rt', params).to_dataframe()\n",
|
112 |
+
"\n",
|
113 |
+
" # Remove NAs\n",
|
114 |
+
" df.dropna(inplace = True)\n",
|
115 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
116 |
+
" df.rename(columns = {'values': 'Unemployment %'}, inplace = True)\n",
|
117 |
+
" df.set_index('region_name', inplace=True) \n",
|
118 |
+
" df = df[['Unemployment %']]\n",
|
119 |
+
" \n",
|
120 |
+
" return df\n"
|
121 |
+
]
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"cell_type": "code",
|
125 |
+
"execution_count": 6,
|
126 |
+
"id": "d88a8821-1ff9-4081-90a5-710b11b03e1a",
|
127 |
+
"metadata": {
|
128 |
+
"tags": []
|
129 |
+
},
|
130 |
+
"outputs": [],
|
131 |
+
"source": [
|
132 |
+
"# Life expectancy\n",
|
133 |
+
"def get_life_expectancy():\n",
|
134 |
+
" params = {'sex': 'T', 'geo': list(regions.keys()), 'time': 2020}\n",
|
135 |
+
" df = client.get_dataset('tgs00101', params).to_dataframe()\n",
|
136 |
+
"\n",
|
137 |
+
" # Remove NAs\n",
|
138 |
+
" df.dropna(inplace = True)\n",
|
139 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
140 |
+
" df.rename(columns = {'values': 'Life Expectancy'}, inplace = True)\n",
|
141 |
+
" df.set_index('region_name', inplace=True) \n",
|
142 |
+
" df = df[['Life Expectancy']]\n",
|
143 |
+
" \n",
|
144 |
+
" return df"
|
145 |
+
]
|
146 |
+
},
|
147 |
+
{
|
148 |
+
"cell_type": "code",
|
149 |
+
"execution_count": 7,
|
150 |
+
"id": "8d9569f3-7ce7-429e-b22a-4abf7a5032bb",
|
151 |
+
"metadata": {},
|
152 |
+
"outputs": [],
|
153 |
+
"source": [
|
154 |
+
"# Get tertiary Educational attainment\n",
|
155 |
+
"def get_tertiary_education():\n",
|
156 |
+
" params = {'sex': 'T', 'geo': list(regions.keys()), 'time': 2020}\n",
|
157 |
+
" df = client.get_dataset('tgs00109', params).to_dataframe()\n",
|
158 |
+
" \n",
|
159 |
+
" # Remove NAs\n",
|
160 |
+
" df.dropna(inplace = True)\n",
|
161 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
162 |
+
" df.rename(columns = {'values': 'Tertiary Educational Attainment %'}, inplace = True)\n",
|
163 |
+
" df.set_index('region_name', inplace=True) \n",
|
164 |
+
" df = df[['Tertiary Educational Attainment %']]\n",
|
165 |
+
" \n",
|
166 |
+
" return df"
|
167 |
+
]
|
168 |
+
},
|
169 |
+
{
|
170 |
+
"cell_type": "code",
|
171 |
+
"execution_count": 8,
|
172 |
+
"id": "2206a2e3-4e77-4725-8bc5-b84978e52dcc",
|
173 |
+
"metadata": {},
|
174 |
+
"outputs": [],
|
175 |
+
"source": [
|
176 |
+
"# Population density\n",
|
177 |
+
"def get_population_density():\n",
|
178 |
+
" params = {'geo': list(regions.keys()), 'time': 2019}\n",
|
179 |
+
" df = client.get_dataset('tgs00024', params).to_dataframe()\n",
|
180 |
+
"\n",
|
181 |
+
" # Remove NAs\n",
|
182 |
+
" df.dropna(inplace = True)\n",
|
183 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
184 |
+
" df.rename(columns = {'values': 'Population Density'}, inplace = True)\n",
|
185 |
+
" df.set_index('region_name', inplace=True) \n",
|
186 |
+
" df = df[['Population Density']]\n",
|
187 |
+
" \n",
|
188 |
+
" return df\n"
|
189 |
+
]
|
190 |
+
},
|
191 |
+
{
|
192 |
+
"cell_type": "code",
|
193 |
+
"execution_count": 9,
|
194 |
+
"id": "2eb66c5f-229b-41c4-adf3-db0ed0cb9589",
|
195 |
+
"metadata": {},
|
196 |
+
"outputs": [],
|
197 |
+
"source": [
|
198 |
+
"# Poverty Risk\n",
|
199 |
+
"def get_poverty_risk():\n",
|
200 |
+
" params = {'geo': list(regions.keys()), 'time': 2019}\n",
|
201 |
+
" df = client.get_dataset('ilc_peps11', params).to_dataframe()\n",
|
202 |
+
" \n",
|
203 |
+
" # Remove NAs\n",
|
204 |
+
" df.dropna(inplace = True)\n",
|
205 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
206 |
+
" df.rename(columns = {'values': 'People at Risk of Poverty %'}, inplace = True)\n",
|
207 |
+
" df.set_index('region_name', inplace=True) \n",
|
208 |
+
" df = df[['People at Risk of Poverty %']]\n",
|
209 |
+
" \n",
|
210 |
+
" return df\n"
|
211 |
+
]
|
212 |
+
},
|
213 |
+
{
|
214 |
+
"cell_type": "code",
|
215 |
+
"execution_count": 10,
|
216 |
+
"id": "757f2be5-2e42-4075-bda1-294d238f5aed",
|
217 |
+
"metadata": {},
|
218 |
+
"outputs": [],
|
219 |
+
"source": [
|
220 |
+
"# Regional availability of doctors\n",
|
221 |
+
"def get_doctors():\n",
|
222 |
+
" params = {'geo': list(regions.keys()), 'time': 2019,'unit': 'P_HTHAB',\n",
|
223 |
+
" 'isco08': 'OC221' }\n",
|
224 |
+
" df = client.get_dataset('hlth_rs_prsrg', params).to_dataframe()\n",
|
225 |
+
"\n",
|
226 |
+
" # Remove NAs\n",
|
227 |
+
" df.dropna(inplace = True)\n",
|
228 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
229 |
+
" df.rename(columns = {'values': 'Doctors per 100000'}, inplace = True)\n",
|
230 |
+
" df.set_index('region_name', inplace=True) \n",
|
231 |
+
" df = df[['Doctors per 100000']]\n",
|
232 |
+
" \n",
|
233 |
+
" return df\n"
|
234 |
+
]
|
235 |
+
},
|
236 |
+
{
|
237 |
+
"cell_type": "code",
|
238 |
+
"execution_count": 11,
|
239 |
+
"id": "f8c52f1a-a7ca-4a0c-8b29-fa22ecc32f47",
|
240 |
+
"metadata": {},
|
241 |
+
"outputs": [],
|
242 |
+
"source": [
|
243 |
+
"# Get deaths in road accidents\n",
|
244 |
+
"def get_fatal_road_accidents():\n",
|
245 |
+
" params = {'victim': 'KIL', 'geo': list(regions.keys()), 'time': 2020,\n",
|
246 |
+
" 'unit': 'P_MHAB'}\n",
|
247 |
+
" df = client.get_dataset('tran_r_acci', params).to_dataframe()\n",
|
248 |
+
"\n",
|
249 |
+
" # Remove NAs\n",
|
250 |
+
" df.dropna(inplace = True)\n",
|
251 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
252 |
+
" df.rename(columns = {'values': 'Fatal Road Accidents per Million'}, inplace = True)\n",
|
253 |
+
" df.set_index('region_name', inplace=True) \n",
|
254 |
+
" df = df[['Fatal Road Accidents per Million']]\n",
|
255 |
+
" \n",
|
256 |
+
" return df\n"
|
257 |
+
]
|
258 |
+
},
|
259 |
+
{
|
260 |
+
"cell_type": "code",
|
261 |
+
"execution_count": 12,
|
262 |
+
"id": "efc48ba6-062d-4e0a-86c1-0df22c6238ff",
|
263 |
+
"metadata": {},
|
264 |
+
"outputs": [],
|
265 |
+
"source": [
|
266 |
+
"# Regular Internet Users\n",
|
267 |
+
"\n",
|
268 |
+
"def get_regular_internet_users():\n",
|
269 |
+
" params = {'indic_is': 'I_IDAY', 'geo': list(regions.keys()), 'time': 2021,\n",
|
270 |
+
" 'unit': 'PC_IND'}\n",
|
271 |
+
" df = client.get_dataset('isoc_r_iuse_i', params).to_dataframe()\n",
|
272 |
+
"\n",
|
273 |
+
" # Remove NAs\n",
|
274 |
+
" df.dropna(inplace = True)\n",
|
275 |
+
" df['region_name'] = df['geo'].apply(lambda x: regions[x])\n",
|
276 |
+
" df.rename(columns = {'values': 'Regular Internet Users %'}, inplace = True)\n",
|
277 |
+
" df.set_index('region_name', inplace=True) \n",
|
278 |
+
" df = df[['Regular Internet Users %']]\n",
|
279 |
+
" \n",
|
280 |
+
" return df\n"
|
281 |
+
]
|
282 |
+
},
|
283 |
+
{
|
284 |
+
"cell_type": "code",
|
285 |
+
"execution_count": 13,
|
286 |
+
"id": "d7b173c5-aa6c-4b21-b1a1-c642b18184ee",
|
287 |
+
"metadata": {
|
288 |
+
"tags": []
|
289 |
+
},
|
290 |
+
"outputs": [],
|
291 |
+
"source": [
|
292 |
+
"# Get all data\n",
|
293 |
+
"df = get_gdp_region()\n",
|
294 |
+
"df = df.join(get_gdp_capita_region())\n",
|
295 |
+
"df = df.join(get_unemployment_region())\n",
|
296 |
+
"df = df.join(get_life_expectancy())\n",
|
297 |
+
"df = df.join(get_doctors())\n",
|
298 |
+
"df = df.join(get_fatal_road_accidents())\n",
|
299 |
+
"df = df.join(get_tertiary_education())\n",
|
300 |
+
"df = df.join(get_population_density())\n",
|
301 |
+
"df = df.join(get_poverty_risk())\n",
|
302 |
+
"df = df.join(get_regular_internet_users())\n",
|
303 |
+
"\n",
|
304 |
+
"# Remove NAs\n",
|
305 |
+
"df.dropna(thresh = 4, inplace = True)"
|
306 |
+
]
|
307 |
+
},
|
308 |
+
{
|
309 |
+
"cell_type": "code",
|
310 |
+
"execution_count": 14,
|
311 |
+
"id": "478f421c-49e8-4334-ad2d-65cafd5b380f",
|
312 |
+
"metadata": {},
|
313 |
+
"outputs": [
|
314 |
+
{
|
315 |
+
"name": "stdout",
|
316 |
+
"output_type": "stream",
|
317 |
+
"text": [
|
318 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
319 |
+
"Index: 242 entries, Abruzzo to Южен централен (Yuzhen tsentralen)\n",
|
320 |
+
"Data columns (total 12 columns):\n",
|
321 |
+
" # Column Non-Null Count Dtype \n",
|
322 |
+
"--- ------ -------------- ----- \n",
|
323 |
+
" 0 Country 242 non-null object \n",
|
324 |
+
" 1 EU Region 242 non-null object \n",
|
325 |
+
" 2 GDP 242 non-null float64\n",
|
326 |
+
" 3 GDP per Capita 242 non-null float64\n",
|
327 |
+
" 4 Unemployment % 238 non-null float64\n",
|
328 |
+
" 5 Life Expectancy 238 non-null float64\n",
|
329 |
+
" 6 Doctors per 100000 173 non-null float64\n",
|
330 |
+
" 7 Fatal Road Accidents per Million 239 non-null float64\n",
|
331 |
+
" 8 Tertiary Educational Attainment % 238 non-null float64\n",
|
332 |
+
" 9 Population Density 239 non-null float64\n",
|
333 |
+
" 10 People at Risk of Poverty % 183 non-null float64\n",
|
334 |
+
" 11 Regular Internet Users % 169 non-null float64\n",
|
335 |
+
"dtypes: float64(10), object(2)\n",
|
336 |
+
"memory usage: 24.6+ KB\n"
|
337 |
+
]
|
338 |
+
}
|
339 |
+
],
|
340 |
+
"source": [
|
341 |
+
"# Check cols\n",
|
342 |
+
"df.info()"
|
343 |
+
]
|
344 |
+
},
|
345 |
+
{
|
346 |
+
"cell_type": "code",
|
347 |
+
"execution_count": 15,
|
348 |
+
"id": "9a335ba4-330e-49a4-bec4-bf37dc4c2e50",
|
349 |
+
"metadata": {
|
350 |
+
"tags": []
|
351 |
+
},
|
352 |
+
"outputs": [],
|
353 |
+
"source": [
|
354 |
+
"# Save to CSV\n",
|
355 |
+
"df.to_csv('../data/eu_regional_data.csv',\n",
|
356 |
+
" float_format = '%.2f', encoding = 'utf-8')"
|
357 |
+
]
|
358 |
+
}
|
359 |
+
],
|
360 |
+
"metadata": {
|
361 |
+
"kernelspec": {
|
362 |
+
"display_name": "base",
|
363 |
+
"language": "python",
|
364 |
+
"name": "python3"
|
365 |
+
},
|
366 |
+
"language_info": {
|
367 |
+
"codemirror_mode": {
|
368 |
+
"name": "ipython",
|
369 |
+
"version": 3
|
370 |
+
},
|
371 |
+
"file_extension": ".py",
|
372 |
+
"mimetype": "text/x-python",
|
373 |
+
"name": "python",
|
374 |
+
"nbconvert_exporter": "python",
|
375 |
+
"pygments_lexer": "ipython3",
|
376 |
+
"version": "3.8.5"
|
377 |
+
},
|
378 |
+
"vscode": {
|
379 |
+
"interpreter": {
|
380 |
+
"hash": "9737f18efb1b9d105cd953add47348769fd82af91ada1884766527cfb8bc009e"
|
381 |
+
}
|
382 |
+
}
|
383 |
+
},
|
384 |
+
"nbformat": 4,
|
385 |
+
"nbformat_minor": 5
|
386 |
+
}
|
data/eu_region_data.csv
ADDED
@@ -0,0 +1,243 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
region_name,Country,EU Region,GDP,GDP per Capita,Unemployment %,Life Expectancy,Doctors per 100000,Fatal Road Accidents per Million,Tertiary Educational Attainment %,Population Density,People at Risk of Poverty %,Regular Internet Users %
|
2 |
+
Abruzzo,IT,Southern Europe,30.89,24000.00,9.30,82.90,435.45,46.00,21.20,120.50,25.00,78.00
|
3 |
+
Alentejo,PT,Southern Europe,12.44,17700.00,6.60,80.20,310.06,135.00,21.40,22.70,22.00,70.00
|
4 |
+
Algarve,PT,Southern Europe,8.71,19900.00,8.30,80.30,419.03,75.00,24.40,88.90,23.20,76.00
|
5 |
+
Alsace,FR,Western Europe,59.58,31000.00,7.10,81.80,362.21,30.00,39.00,230.60,,75.00
|
6 |
+
Andalucía,ES,Southern Europe,150.56,17700.00,21.70,81.70,371.83,30.00,32.50,97.40,37.70,84.00
|
7 |
+
Aquitaine,FR,Western Europe,103.98,29600.00,7.40,83.50,363.49,47.00,36.00,83.90,,81.00
|
8 |
+
Aragón,ES,Southern Europe,35.29,26500.00,10.20,82.30,502.84,51.00,39.70,27.90,21.10,85.00
|
9 |
+
Arnsberg,DE,Western Europe,125.49,35100.00,4.30,80.20,,21.00,25.50,449.10,18.50,
|
10 |
+
Auvergne,FR,Western Europe,37.18,27000.00,7.00,82.10,311.28,52.00,31.20,52.60,,68.00
|
11 |
+
"Aνατολική Μακεδονία, Θράκη (Anatoliki Makedonia, Thraki)",EL,Southern Europe,6.49,10900.00,18.50,80.00,510.88,47.00,24.40,42.80,35.20,
|
12 |
+
Aττική (Attiki),EL,Southern Europe,78.18,20900.00,11.90,81.10,813.51,40.00,41.00,987.50,24.80,
|
13 |
+
Basilicata,IT,Southern Europe,11.64,21200.00,8.30,82.80,351.49,33.00,17.60,55.70,34.70,74.00
|
14 |
+
Basse-Normandie ,FR,Western Europe,38.75,26400.00,6.40,82.10,303.75,55.00,32.60,82.60,,79.00
|
15 |
+
Berlin,DE,Western Europe,155.17,42300.00,5.70,80.90,,14.00,42.90,4322.90,19.30,
|
16 |
+
Bourgogne,FR,Western Europe,45.36,27900.00,7.10,81.70,295.55,62.00,35.00,51.30,,77.00
|
17 |
+
Brandenburg,DE,Western Europe,74.92,29700.00,3.00,80.60,,56.00,29.20,86.70,17.00,
|
18 |
+
Bratislavský kraj,SK,Central and Eastern Europe,26.19,38900.00,2.60,78.80,648.52,36.00,45.60,328.80,7.90,90.00
|
19 |
+
Braunschweig,DE,Western Europe,75.52,47400.00,3.80,80.80,,40.00,32.00,197.30,18.10,
|
20 |
+
Bremen,DE,Western Europe,31.93,46900.00,6.90,80.00,,21.00,30.80,1744.50,26.50,
|
21 |
+
Bretagne,FR,Western Europe,99.65,29400.00,5.80,82.60,325.67,41.00,38.10,122.40,,80.00
|
22 |
+
Bucureşti-Ilfov,RO,Central and Eastern Europe,60.31,26000.00,3.50,75.50,617.92,46.00,40.50,1321.90,14.00,77.00
|
23 |
+
Budapest,HU,Central and Eastern Europe,50.43,29000.00,2.90,77.90,570.91,19.00,49.80,3433.80,15.60,92.00
|
24 |
+
Burgenland,AT,Western Europe,8.92,30200.00,5.10,81.80,434.45,61.00,33.10,77.80,,78.00
|
25 |
+
Calabria,IT,Southern Europe,30.90,16500.00,18.00,82.50,388.11,32.00,16.00,126.50,39.80,72.00
|
26 |
+
Campania,IT,Southern Europe,102.83,18100.00,19.30,81.20,390.99,31.00,16.30,422.20,49.70,74.00
|
27 |
+
Canarias,ES,Southern Europe,39.16,17400.00,23.20,83.40,394.47,22.00,34.40,299.40,35.00,84.00
|
28 |
+
Cantabria,ES,Southern Europe,12.87,22100.00,11.50,83.20,515.45,27.00,42.50,110.50,19.40,82.00
|
29 |
+
Castilla y León,ES,Southern Europe,55.40,23200.00,11.40,82.40,465.79,52.00,39.00,25.60,16.70,83.00
|
30 |
+
Castilla-La Mancha,ES,Southern Europe,39.57,19400.00,15.60,81.10,282.57,47.00,30.80,25.80,30.70,84.00
|
31 |
+
Cataluña,ES,Southern Europe,212.93,27800.00,11.60,82.30,489.63,27.00,42.30,238.10,18.80,88.00
|
32 |
+
Centre — Val de Loire,FR,Western Europe,71.57,27800.00,7.20,82.40,260.16,43.00,31.90,65.40,,76.00
|
33 |
+
Centro (PT),PT,Southern Europe,38.41,17300.00,5.80,81.50,500.38,66.00,26.20,79.20,20.40,72.00
|
34 |
+
Centru,RO,Central and Eastern Europe,24.57,10600.00,5.10,74.40,321.08,85.00,17.10,68.20,24.40,72.00
|
35 |
+
Champagne-Ardenne,FR,Western Europe,36.66,27800.00,8.90,81.00,289.95,56.00,24.80,51.50,,76.00
|
36 |
+
Chemnitz,DE,Western Europe,41.28,29100.00,2.30,80.00,,47.00,27.00,219.90,18.30,
|
37 |
+
Ciudad de Ceuta,ES,Southern Europe,1.64,19500.00,26.60,79.80,905.79,24.00,25.70,4222.90,45.90,88.00
|
38 |
+
Ciudad de Melilla,ES,Southern Europe,1.51,17900.00,19.80,79.30,,12.00,34.30,6041.50,38.50,87.00
|
39 |
+
Comunidad Foral de Navarra,ES,Southern Europe,19.26,29300.00,10.60,83.40,540.39,30.00,48.40,63.10,11.70,86.00
|
40 |
+
Comunidad de Madrid,ES,Southern Europe,216.53,32000.00,11.60,82.30,519.84,16.00,50.20,839.70,19.00,90.00
|
41 |
+
Comunitat Valenciana ,ES,Southern Europe,104.72,20800.00,15.90,82.60,393.03,26.00,38.00,216.20,27.00,87.00
|
42 |
+
Corse,FR,Western Europe,8.82,25500.00,9.10,84.00,301.69,49.00,39.30,39.60,,74.00
|
43 |
+
Darmstadt,DE,Western Europe,203.86,50700.00,4.10,81.80,,27.00,32.70,542.20,13.50,
|
44 |
+
Detmold,DE,Western Europe,78.67,38300.00,4.10,81.40,,34.00,25.90,316.30,15.50,
|
45 |
+
Dolnośląskie,PL,Central and Eastern Europe,43.81,15100.00,4.00,76.20,,58.00,36.10,144.90,14.50,
|
46 |
+
Drenthe,NL,Western Europe,15.58,31500.00,3.50,81.60,295.79,59.00,34.60,184.50,14.30,94.00
|
47 |
+
Dresden,DE,Western Europe,50.63,31800.00,3.30,80.80,,26.00,32.10,205.60,16.60,
|
48 |
+
Dél-Alföld,HU,Central and Eastern Europe,12.62,10300.00,4.50,75.40,358.32,54.00,21.60,68.10,14.90,79.00
|
49 |
+
Dél-Dunántúl,HU,Central and Eastern Europe,8.44,9700.00,4.80,75.60,359.37,55.00,18.50,63.70,24.60,82.00
|
50 |
+
Düsseldorf,DE,Western Europe,217.05,41700.00,4.50,80.50,,24.00,28.90,1006.70,20.50,
|
51 |
+
Eastern and Midland,IE,Western Europe,186.17,75700.00,6.40,82.60,,21.00,53.90,169.80,19.00,95.00
|
52 |
+
Eesti,EE,Northern Europe,26.83,20200.00,6.20,78.90,346.90,45.00,40.10,30.50,,85.00
|
53 |
+
Emilia-Romagna,IT,Southern Europe,149.36,33600.00,5.50,82.60,425.23,50.00,23.30,201.90,15.50,83.00
|
54 |
+
Etelä-Suomi,FI,Northern Europe,43.47,37900.00,7.50,81.90,,42.00,43.50,36.60,16.30,91.00
|
55 |
+
Extremadura,ES,Southern Europe,19.39,18300.00,19.50,81.80,306.95,38.00,26.70,26.00,37.70,81.00
|
56 |
+
Flevoland,NL,Western Europe,14.63,34300.00,4.60,81.70,126.49,24.00,35.00,292.50,15.80,92.00
|
57 |
+
Franche-Comté,FR,Western Europe,30.19,25500.00,7.00,81.60,307.48,54.00,33.80,72.60,,78.00
|
58 |
+
Freiburg,DE,Western Europe,86.68,38100.00,3.00,82.20,,34.00,33.60,244.90,13.50,
|
59 |
+
Friesland (NL),NL,Western Europe,21.00,32300.00,4.50,81.90,237.36,54.00,34.30,191.00,16.70,91.00
|
60 |
+
Friuli-Venezia Giulia,IT,Southern Europe,36.88,30600.00,5.70,82.80,404.61,39.00,21.40,159.90,13.80,82.00
|
61 |
+
Galicia,ES,Southern Europe,59.11,21900.00,11.70,83.70,474.96,38.00,40.30,92.00,24.30,81.00
|
62 |
+
Gelderland,NL,Western Europe,82.04,39200.00,3.90,81.40,371.53,41.00,38.10,415.80,14.70,90.00
|
63 |
+
Gießen,DE,Western Europe,36.12,34400.00,3.50,81.00,,46.00,30.00,194.90,17.10,
|
64 |
+
Grad Zagreb,HR,Central and Eastern Europe,17.55,23400.00,5.50,,,,,,,
|
65 |
+
Groningen,NL,Western Europe,23.24,39700.00,5.40,81.10,546.22,46.00,40.60,247.90,23.00,90.00
|
66 |
+
Guadeloupe,FR,Western Europe,9.29,22600.00,17.10,80.60,277.88,124.00,23.30,247.00,,65.00
|
67 |
+
Guyane,FR,Western Europe,4.35,15000.00,14.60,,219.22,115.00,18.70,3.40,,79.00
|
68 |
+
Hamburg,DE,Western Europe,119.14,64400.00,4.40,81.40,,8.00,36.70,2597.50,23.70,
|
69 |
+
Hannover,DE,Western Europe,84.49,39300.00,2.80,80.90,,43.00,28.30,239.00,17.60,
|
70 |
+
Haute-Normandie ,FR,Western Europe,51.35,27600.00,7.60,81.10,274.59,35.00,31.80,151.20,,73.00
|
71 |
+
Helsinki-Uusimaa,FI,Northern Europe,93.28,55000.00,7.70,82.30,,27.00,54.90,184.70,10.10,95.00
|
72 |
+
Hovedstaden,DK,Northern Europe,128.90,69700.00,5.70,81.50,500.65,15.00,53.10,756.00,17.50,95.00
|
73 |
+
Ile-de-France,FR,Western Europe,710.09,57400.00,8.00,82.70,386.90,20.00,54.30,1026.80,,83.00
|
74 |
+
Illes Balears,ES,Southern Europe,26.79,22000.00,14.80,83.90,366.83,31.00,34.80,241.20,15.10,89.00
|
75 |
+
Jadranska Hrvatska,HR,Central and Eastern Europe,15.41,11500.00,9.50,79.30,327.82,71.00,26.40,56.00,22.00,78.00
|
76 |
+
Jihovýchod,CZ,Central and Eastern Europe,31.79,18700.00,2.40,78.80,430.81,58.00,27.70,124.00,12.50,80.00
|
77 |
+
Jihozápad,CZ,Central and Eastern Europe,20.98,17000.00,2.40,78.60,377.68,62.00,19.80,71.80,9.60,80.00
|
78 |
+
Karlsruhe,DE,Western Europe,123.72,44000.00,3.30,81.80,,33.00,34.50,409.30,14.50,
|
79 |
+
Kassel,DE,Western Europe,44.27,36300.00,2.90,80.90,,41.00,28.10,147.50,15.30,
|
80 |
+
Koblenz,DE,Western Europe,50.57,33700.00,2.90,81.00,,35.00,27.30,186.70,19.80,
|
81 |
+
Kujawsko-pomorskie,PL,Central and Eastern Europe,23.03,11100.00,4.40,76.30,,65.00,26.60,116.80,23.20,
|
82 |
+
Kärnten,AT,Western Europe,20.70,36900.00,5.60,81.40,485.10,62.00,32.10,59.90,,75.00
|
83 |
+
Köln,DE,Western Europe,193.31,43200.00,4.00,81.30,,21.00,32.20,613.40,19.70,
|
84 |
+
Közép-Dunántúl,HU,Central and Eastern Europe,13.46,12700.00,2.10,75.40,244.93,73.00,22.10,99.10,13.50,80.00
|
85 |
+
La Rioja,ES,Southern Europe,8.13,25700.00,11.50,82.50,349.48,51.00,38.50,62.60,15.20,82.00
|
86 |
+
La Réunion ,FR,Western Europe,19.15,22100.00,17.90,81.90,337.69,50.00,22.90,345.70,,61.00
|
87 |
+
Languedoc-Roussillon,FR,Western Europe,74.01,25600.00,11.40,82.70,365.77,48.00,41.00,104.40,,73.00
|
88 |
+
Latvija,LV,Northern Europe,29.47,15500.00,7.60,75.50,326.73,73.00,37.80,30.20,,84.00
|
89 |
+
Lazio,IT,Southern Europe,186.30,32400.00,10.00,83.10,473.79,45.00,27.00,343.00,24.80,83.00
|
90 |
+
Leipzig,DE,Western Europe,34.97,33300.00,4.50,80.80,,39.00,37.00,268.40,20.20,
|
91 |
+
Liguria,IT,Southern Europe,46.09,30300.00,8.40,81.90,462.36,39.00,21.80,284.30,17.60,84.00
|
92 |
+
Limburg (NL),NL,Western Europe,45.19,40500.00,3.80,80.90,354.09,47.00,34.60,517.70,15.30,88.00
|
93 |
+
Limousin,FR,Western Europe,18.08,24800.00,6.30,82.50,337.16,47.00,33.80,42.90,,76.00
|
94 |
+
Lombardia,IT,Southern Europe,365.51,36500.00,5.90,81.40,372.88,32.00,21.70,435.80,16.20,82.00
|
95 |
+
Lorraine,FR,Western Europe,56.55,24300.00,8.50,81.00,302.64,38.00,32.50,98.60,,77.00
|
96 |
+
Lubelskie,PL,Central and Eastern Europe,19.56,9300.00,5.20,76.50,,75.00,33.40,84.00,28.80,
|
97 |
+
Lubuskie,PL,Central and Eastern Europe,11.23,11100.00,,75.80,,76.00,27.90,72.60,14.50,
|
98 |
+
Luxembourg,LU,Western Europe,64.22,101800.00,5.30,82.20,,42.00,47.10,239.80,,94.00
|
99 |
+
Länsi-Suomi,FI,Northern Europe,52.23,37900.00,7.70,82.30,,49.00,45.90,23.70,,93.00
|
100 |
+
Lüneburg,DE,Western Europe,49.23,28600.00,3.00,81.00,,51.00,26.90,111.40,16.20,
|
101 |
+
Malta,MT,Southern Europe,13.07,25300.00,3.50,82.30,,23.00,30.60,1595.10,,84.00
|
102 |
+
Marche,IT,Southern Europe,39.66,26300.00,7.10,83.20,382.59,46.00,21.20,161.90,19.10,80.00
|
103 |
+
Martinique ,FR,Western Europe,8.86,24600.00,12.80,81.90,305.98,78.00,27.10,328.60,,68.00
|
104 |
+
Mayotte,FR,Western Europe,2.76,9700.00,,73.30,81.01,36.00,,750.80,,
|
105 |
+
Mazowiecki regionalny,PL,Central and Eastern Europe,27.11,11600.00,3.80,75.30,,123.00,26.50,79.50,21.30,
|
106 |
+
Małopolskie,PL,Central and Eastern Europe,42.61,12500.00,3.20,77.60,,47.00,33.80,224.00,18.50,
|
107 |
+
Mecklenburg-Vorpommern,DE,Western Europe,46.59,28900.00,3.80,80.40,,44.00,27.30,71.30,23.20,
|
108 |
+
Mellersta Norrland,SE,Northern Europe,14.52,38600.00,6.30,81.40,380.37,48.00,37.00,5.30,23.60,92.00
|
109 |
+
Midi-Pyrénées,FR,Western Europe,94.73,30400.00,6.10,83.60,342.55,48.00,43.30,67.80,,77.00
|
110 |
+
Midtjylland,DK,Northern Europe,65.33,49200.00,4.80,82.10,407.93,32.00,38.90,103.70,16.30,96.00
|
111 |
+
Mittelfranken,DE,Western Europe,79.56,44800.00,3.60,80.90,,29.00,33.80,245.70,18.40,
|
112 |
+
Molise,IT,Southern Europe,6.09,20500.00,10.90,82.40,415.35,83.00,18.50,68.20,38.10,72.00
|
113 |
+
Moravskoslezsko,CZ,Central and Eastern Europe,18.78,15700.00,4.60,76.80,375.90,36.00,21.10,226.20,14.90,84.00
|
114 |
+
Münster,DE,Western Europe,89.38,34100.00,3.40,80.90,,26.00,26.60,380.10,18.40,
|
115 |
+
Niederbayern,DE,Western Europe,48.48,38900.00,1.80,80.80,,54.00,24.40,121.00,,
|
116 |
+
Niederösterreich,AT,Western Europe,59.52,35300.00,5.10,81.30,471.11,53.00,33.00,88.90,,84.00
|
117 |
+
Noord-Brabant,NL,Western Europe,120.73,47000.00,3.20,81.10,265.28,39.00,41.10,514.80,13.90,91.00
|
118 |
+
Noord-Holland,NL,Western Europe,171.05,59300.00,4.50,81.70,487.96,30.00,49.90,1041.20,17.00,93.00
|
119 |
+
Nord-Est,RO,Central and Eastern Europe,22.81,7200.00,6.80,73.30,255.50,98.00,11.80,87.50,47.10,64.00
|
120 |
+
Nord-Pas de Calais,FR,Western Europe,113.78,27900.00,8.80,80.40,319.98,23.00,32.10,327.40,,76.00
|
121 |
+
Nord-Vest,RO,Central and Eastern Europe,26.90,10600.00,3.10,74.10,335.01,80.00,20.10,75.00,19.30,75.00
|
122 |
+
Nordjylland,DK,Northern Europe,26.33,44600.00,5.00,81.80,346.36,29.00,32.00,76.40,17.70,93.00
|
123 |
+
Norra Mellansverige,SE,Northern Europe,31.23,36400.00,9.70,82.20,359.02,31.00,35.30,13.50,18.30,91.00
|
124 |
+
Norte,PT,Southern Europe,60.33,16900.00,6.60,81.30,531.76,39.00,24.90,169.30,23.20,70.00
|
125 |
+
Northern and Western,IE,Western Europe,26.43,30100.00,5.10,82.90,,38.00,46.40,35.00,25.40,97.00
|
126 |
+
Nyugat-Dunántúl,HU,Central and Eastern Europe,13.28,13300.00,2.20,76.00,283.58,49.00,25.00,88.60,16.30,82.00
|
127 |
+
Oberbayern,DE,Western Europe,273.50,58000.00,2.70,82.40,,36.00,41.80,273.40,14.80,
|
128 |
+
Oberfranken,DE,Western Europe,40.74,38300.00,3.30,80.70,,32.00,27.70,147.80,18.70,
|
129 |
+
Oberpfalz,DE,Western Europe,46.41,41700.00,2.50,80.70,,42.00,29.70,115.20,,
|
130 |
+
Oberösterreich,AT,Western Europe,65.24,43700.00,3.80,81.70,426.53,45.00,31.10,126.80,,81.00
|
131 |
+
Opolskie,PL,Central and Eastern Europe,10.53,10700.00,2.80,76.60,,69.00,27.60,101.40,17.00,
|
132 |
+
Overijssel,NL,Western Europe,45.70,39300.00,3.80,81.20,265.13,40.00,37.70,344.90,15.80,90.00
|
133 |
+
Panonska Hrvatska,HR,Central and Eastern Europe,9.17,7900.00,9.70,,,,,,,
|
134 |
+
Pays de la Loire,FR,Western Europe,116.15,30100.00,6.00,83.20,292.99,42.00,35.90,118.30,,78.00
|
135 |
+
País Vasco,ES,Southern Europe,66.56,30400.00,9.80,83.40,563.31,19.00,53.40,303.70,14.40,84.00
|
136 |
+
Pest,HU,Central and Eastern Europe,14.60,11200.00,3.00,76.00,258.85,56.00,30.70,205.10,19.10,86.00
|
137 |
+
Picardie,FR,Western Europe,47.85,24700.00,9.70,80.40,257.53,50.00,32.60,99.40,,77.00
|
138 |
+
Piemonte,IT,Southern Europe,126.20,29400.00,7.30,81.60,370.31,42.00,19.80,172.30,16.70,80.00
|
139 |
+
Podkarpackie,PL,Central and Eastern Europe,20.07,9400.00,4.80,77.50,,63.00,29.60,117.80,22.30,
|
140 |
+
Podlaskie,PL,Central and Eastern Europe,11.79,10000.00,3.20,77.10,,68.00,31.40,57.50,20.80,
|
141 |
+
Pohjois- ja Itä-Suomi,FI,Northern Europe,45.78,35900.00,7.80,81.50,,48.00,42.00,6.30,19.00,91.00
|
142 |
+
Poitou-Charentes,FR,Western Europe,50.04,27400.00,8.60,82.80,298.29,56.00,33.40,70.00,,80.00
|
143 |
+
Pomorskie,PL,Central and Eastern Europe,30.46,13000.00,2.30,77.20,,73.00,34.90,130.60,15.30,
|
144 |
+
Praha,CZ,Central and Eastern Europe,58.04,43700.00,2.30,80.30,736.22,17.00,45.90,2714.30,7.90,88.00
|
145 |
+
Principado de Asturias,ES,Southern Europe,21.47,21100.00,12.50,82.20,398.31,22.00,44.20,96.60,24.60,85.00
|
146 |
+
Prov. Antwerpen,BE,Western Europe,88.19,47000.00,5.20,82.00,271.16,33.00,41.00,665.80,,86.00
|
147 |
+
Prov. Brabant Wallon,BE,Western Europe,22.20,54400.00,6.80,81.90,525.24,47.00,59.70,369.70,,92.00
|
148 |
+
Prov. Hainaut,BE,Western Europe,33.11,24500.00,10.30,78.00,253.30,57.00,32.40,354.80,,77.00
|
149 |
+
Prov. Limburg (BE),BE,Western Europe,28.07,31800.00,3.40,82.30,256.65,47.00,37.70,367.50,,87.00
|
150 |
+
Prov. Liège,BE,Western Europe,30.96,27800.00,9.40,78.60,358.81,56.00,39.70,289.70,,84.00
|
151 |
+
Prov. Luxembourg (BE),BE,Western Europe,6.95,23900.00,5.60,79.90,231.48,100.00,42.50,64.60,,85.00
|
152 |
+
Prov. Namur,BE,Western Europe,13.18,26400.00,7.60,79.30,351.89,84.00,40.80,135.90,,80.00
|
153 |
+
Prov. Oost-Vlaanderen,BE,Western Europe,54.76,35800.00,2.80,81.80,292.63,45.00,44.10,512.30,,90.00
|
154 |
+
Prov. Vlaams-Brabant,BE,Western Europe,49.71,42800.00,4.00,82.60,409.53,28.00,51.40,544.70,,91.00
|
155 |
+
Prov. West-Vlaanderen,BE,Western Europe,45.61,37900.00,3.60,81.90,262.07,42.00,38.70,380.80,,89.00
|
156 |
+
Provence-Alpes-Côte d’Azur,FR,Western Europe,161.29,31500.00,8.10,83.00,404.03,45.00,40.00,162.40,,76.00
|
157 |
+
Provincia Autonoma di Bolzano/Bozen,IT,Southern Europe,23.72,44400.00,3.80,82.80,324.38,58.00,17.60,72.20,11.50,82.00
|
158 |
+
Provincia Autonoma di Trento,IT,Southern Europe,20.04,36900.00,4.80,82.80,329.25,46.00,22.40,88.20,14.00,83.00
|
159 |
+
Puglia,IT,Southern Europe,71.64,18200.00,14.60,82.70,384.75,40.00,15.30,206.80,37.40,70.00
|
160 |
+
Região Autónoma da Madeira,PT,Southern Europe,4.46,17600.00,8.00,79.10,442.35,39.00,22.90,318.00,32.20,76.00
|
161 |
+
Região Autónoma dos Açores,PT,Southern Europe,4.15,17100.00,7.20,77.90,354.58,70.00,15.80,105.30,36.70,71.00
|
162 |
+
Región de Murcia,ES,Southern Europe,29.94,19800.00,14.30,82.40,452.19,26.00,32.80,132.40,31.90,87.00
|
163 |
+
Rheinhessen-Pfalz,DE,Western Europe,76.69,37200.00,4.40,81.20,,23.00,32.70,303.20,16.50,
|
164 |
+
Rhône-Alpes,FR,Western Europe,231.70,34300.00,7.20,82.80,345.62,39.00,43.20,150.90,,78.00
|
165 |
+
Région de Bruxelles-Capitale/ Brussels Hoofdstedelijk Gewest,BE,Western Europe,83.85,68400.00,12.40,79.40,390.38,13.00,49.30,7526.70,,89.00
|
166 |
+
Saarland,DE,Western Europe,33.95,34500.00,3.00,80.20,,21.00,26.30,385.50,21.60,
|
167 |
+
Sachsen-Anhalt,DE,Western Europe,63.54,29000.00,4.40,79.70,,56.00,22.60,108.70,18.60,
|
168 |
+
Salzburg,AT,Western Europe,27.95,49900.00,4.60,82.20,581.16,50.00,32.50,78.90,,81.00
|
169 |
+
Sardegna,IT,Southern Europe,32.38,20200.00,13.50,82.80,482.15,59.00,17.70,68.30,28.10,80.00
|
170 |
+
Schleswig-Holstein,DE,Western Europe,98.36,33800.00,3.40,81.20,,37.00,26.90,188.20,20.80,
|
171 |
+
Schwaben,DE,Western Europe,74.76,39300.00,2.90,81.80,,37.00,32.40,191.50,16.30,
|
172 |
+
Severovýchod,CZ,Central and Eastern Europe,25.46,16800.00,2.40,78.70,350.83,53.00,20.50,123.70,12.90,77.00
|
173 |
+
Severozápad,CZ,Central and Eastern Europe,15.20,13600.00,4.30,76.40,325.10,56.00,13.70,131.70,21.50,76.00
|
174 |
+
Sicilia,IT,Southern Europe,83.33,17200.00,18.70,81.90,441.16,33.00,14.90,192.10,48.70,70.00
|
175 |
+
Sjeverna Hrvatska,HR,Central and Eastern Europe,8.06,10000.00,4.60,,,,,,,
|
176 |
+
Sjælland,DK,Northern Europe,31.53,37600.00,5.00,80.60,364.26,26.00,30.40,118.30,12.30,94.00
|
177 |
+
Småland med öarna,SE,Northern Europe,33.34,38200.00,7.50,82.50,382.98,23.00,37.20,26.20,16.40,90.00
|
178 |
+
Sostinės regionas,LT,Northern Europe,21.14,25600.00,4.80,75.80,580.98,50.00,58.60,86.60,21.20,81.00
|
179 |
+
Southern,IE,Western Europe,160.27,97500.00,6.50,82.50,,38.00,45.60,55.60,20.40,92.00
|
180 |
+
Steiermark,AT,Western Europe,48.59,39000.00,4.30,81.10,521.32,42.00,31.10,76.60,,75.00
|
181 |
+
Stockholm,SE,Northern Europe,153.56,64400.00,8.20,82.30,458.82,5.00,53.70,361.80,14.80,94.00
|
182 |
+
Stredné Slovensko,SK,Central and Eastern Europe,17.92,13400.00,7.50,76.80,330.86,56.00,23.70,82.70,21.50,79.00
|
183 |
+
Stuttgart,DE,Western Europe,215.44,51900.00,3.10,82.30,,24.00,34.70,393.30,13.30,
|
184 |
+
Střední Morava,CZ,Central and Eastern Europe,19.96,16500.00,2.20,77.80,380.58,40.00,22.30,133.20,12.90,81.00
|
185 |
+
Střední Čechy,CZ,Central and Eastern Europe,25.05,18000.00,2.50,78.50,265.17,62.00,24.20,128.50,9.60,79.00
|
186 |
+
Sud-Est,RO,Central and Eastern Europe,21.53,9100.00,6.00,73.70,219.85,95.00,13.10,70.90,40.10,64.00
|
187 |
+
Sud-Muntenia,RO,Central and Eastern Europe,24.95,8600.00,7.70,73.70,159.76,99.00,13.10,86.10,36.50,65.00
|
188 |
+
Sud-Vest Oltenia,RO,Central and Eastern Europe,16.92,8900.00,9.20,75.00,311.52,90.00,16.70,66.90,38.90,62.00
|
189 |
+
Syddanmark,DK,Northern Europe,58.01,47400.00,4.40,81.80,408.18,43.00,33.50,102.00,16.60,94.00
|
190 |
+
Sydsverige,SE,Northern Europe,61.75,40000.00,11.20,82.60,434.48,27.00,45.40,110.10,25.40,91.00
|
191 |
+
Thüringen,DE,Western Europe,62.22,29300.00,3.30,80.70,,39.00,29.10,132.40,19.30,
|
192 |
+
Tirol,AT,Western Europe,33.45,44100.00,4.80,82.40,588.76,34.00,31.90,60.40,,81.00
|
193 |
+
Toscana,IT,Southern Europe,111.31,30100.00,7.50,83.40,444.77,41.00,21.10,162.70,18.70,83.00
|
194 |
+
Trier,DE,Western Europe,16.30,30500.00,,81.10,,51.00,31.60,108.50,21.40,
|
195 |
+
Tübingen,DE,Western Europe,80.71,43300.00,2.90,82.50,,33.00,32.20,214.20,14.10,
|
196 |
+
Umbria,IT,Southern Europe,21.45,24700.00,6.60,83.70,456.90,52.00,23.10,105.50,13.30,83.00
|
197 |
+
Unterfranken,DE,Western Europe,53.07,40300.00,2.30,82.00,,34.00,31.30,155.10,17.50,
|
198 |
+
Utrecht,NL,Western Europe,76.84,58100.00,4.00,81.80,590.14,25.00,55.70,934.60,15.60,93.00
|
199 |
+
Valle d’Aosta/Vallée d’Aoste,IT,Southern Europe,4.52,36300.00,7.30,81.40,366.99,0.00,18.90,38.60,8.10,84.00
|
200 |
+
Veneto,IT,Southern Europe,151.91,31200.00,5.30,83.10,345.71,47.00,19.80,282.00,11.10,81.00
|
201 |
+
Vest,RO,Central and Eastern Europe,20.72,11700.00,3.50,74.00,416.35,81.00,17.00,55.70,21.90,71.00
|
202 |
+
Vidurio ir vakarų Lietuvos regionas ,LT,Northern Europe,28.37,14400.00,8.20,74.80,405.84,68.00,37.80,37.20,28.30,76.00
|
203 |
+
Vorarlberg,AT,Western Europe,18.21,45700.00,4.10,82.50,432.63,40.00,29.20,156.30,,79.00
|
204 |
+
Vzhodna Slovenija,SI,Central and Eastern Europe,20.39,18500.00,5.00,79.50,276.15,41.00,30.80,89.00,17.00,81.00
|
205 |
+
Västsverige,SE,Northern Europe,90.35,43800.00,8.40,82.70,420.85,17.00,43.40,70.10,19.20,93.00
|
206 |
+
Východné Slovensko,SK,Central and Eastern Europe,19.61,12000.00,10.90,76.60,347.60,27.00,26.60,103.90,21.20,78.00
|
207 |
+
Warmińsko-mazurskie,PL,Central and Eastern Europe,13.61,9600.00,3.50,76.10,,82.00,23.60,61.10,24.20,
|
208 |
+
Warszawski stołeczny,PL,Central and Eastern Europe,92.91,30000.00,2.10,78.00,,43.00,57.20,510.20,13.40,
|
209 |
+
Weser-Ems,DE,Western Europe,90.85,35800.00,3.40,80.80,,50.00,25.00,169.80,17.10,
|
210 |
+
Wielkopolskie,PL,Central and Eastern Europe,52.16,14900.00,2.20,76.60,,62.00,29.30,117.90,17.50,
|
211 |
+
Wien,AT,Western Europe,96.59,50400.00,12.10,80.20,686.75,6.00,42.70,4808.90,,86.00
|
212 |
+
Zachodniopomorskie,PL,Central and Eastern Europe,19.32,11400.00,3.50,76.20,,60.00,29.60,76.60,17.10,
|
213 |
+
Zahodna Slovenija,SI,Central and Eastern Europe,26.53,26500.00,4.50,81.80,381.57,35.00,41.60,126.90,11.50,89.00
|
214 |
+
Zeeland,NL,Western Europe,13.99,36400.00,3.60,82.40,165.16,57.00,31.80,212.60,14.30,97.00
|
215 |
+
Zuid-Holland,NL,Western Europe,168.99,45000.00,5.10,81.30,369.44,22.00,44.20,1292.20,19.40,92.00
|
216 |
+
Západné Slovensko,SK,Central and Eastern Europe,28.36,15600.00,4.70,77.10,277.43,57.00,22.40,123.00,11.30,79.00
|
217 |
+
Área Metropolitana de Lisboa,PT,Southern Europe,71.43,24900.00,6.80,81.40,652.83,33.00,38.00,1015.90,17.80,83.00
|
218 |
+
Åland,FI,Northern Europe,1.17,38900.00,,83.30,,0.00,41.60,19.20,,
|
219 |
+
Észak-Alföld,HU,Central and Eastern Europe,13.23,9200.00,7.10,74.80,326.17,46.00,19.20,83.10,24.20,76.00
|
220 |
+
Észak-Magyarország,HU,Central and Eastern Europe,10.56,9500.00,6.20,73.80,240.10,42.00,16.80,84.40,23.90,76.00
|
221 |
+
Östra Mellansverige,SE,Northern Europe,66.87,38600.00,9.80,82.30,449.97,22.00,42.80,44.70,18.70,92.00
|
222 |
+
Övre Norrland,SE,Northern Europe,23.81,45600.00,6.10,82.20,457.75,23.00,40.00,3.40,16.60,87.00
|
223 |
+
Łódzkie,PL,Central and Eastern Europe,32.43,13200.00,4.40,75.30,,90.00,30.20,135.20,16.50,
|
224 |
+
Śląskie,PL,Central and Eastern Europe,60.97,13500.00,2.90,76.10,,42.00,30.70,368.80,13.80,
|
225 |
+
Świętokrzyskie,PL,Central and Eastern Europe,12.08,9800.00,4.40,76.10,,79.00,31.90,105.10,20.70,
|
226 |
+
Ήπειρος (Ipeiros),EL,Southern Europe,3.72,11200.00,15.10,83.80,666.61,75.00,31.60,36.80,27.60,
|
227 |
+
Βόρειο Αιγαίο (Voreio Aigaio),EL,Southern Europe,2.33,10100.00,13.90,82.60,320.01,52.00,29.30,59.30,35.50,
|
228 |
+
Δυτική Ελλάδα (Dytiki Ellada),EL,Southern Europe,7.40,11400.00,17.50,81.70,494.85,89.00,25.00,59.20,40.90,
|
229 |
+
Δυτική Μακεδονία (Dytiki Makedonia),EL,Southern Europe,3.32,12600.00,19.80,81.70,343.82,38.00,26.60,28.80,34.80,
|
230 |
+
Θεσσαλία (Thessalia),EL,Southern Europe,8.71,12200.00,16.70,81.50,531.19,56.00,30.30,51.40,28.00,
|
231 |
+
Ιόνια Νησιά (Ionia Nisia),EL,Southern Europe,2.81,13800.00,13.20,81.50,525.28,44.00,23.70,89.40,25.70,
|
232 |
+
Κεντρική Μακεδονία (Kentriki Makedonia),EL,Southern Europe,22.70,12100.00,16.10,80.50,613.53,55.00,32.20,101.20,31.70,
|
233 |
+
Κρήτη (Kriti),EL,Southern Europe,8.19,12800.00,16.30,82.60,610.65,44.00,28.00,76.50,31.60,
|
234 |
+
Κύπρος (Kypros),CY,Southern Europe,21.55,24200.00,7.50,82.40,427.23,54.00,44.90,95.70,,89.00
|
235 |
+
Νότιο Αιγαίο (Notio Aigaio),EL,Southern Europe,5.45,15600.00,18.80,82.60,370.19,86.00,22.50,66.10,34.50,
|
236 |
+
Πελοπόννησος (Peloponnisos),EL,Southern Europe,7.65,13400.00,12.70,82.10,385.66,75.00,23.90,37.10,36.40,
|
237 |
+
Στερεά Ελλάδα (Sterea Ellada),EL,Southern Europe,8.38,15100.00,17.20,82.30,312.24,86.00,25.20,36.10,29.50,
|
238 |
+
Северен централен (Severen tsentralen),BG,Central and Eastern Europe,4.59,6000.00,6.70,72.80,333.20,81.00,26.50,53.10,35.90,70.00
|
239 |
+
Северозападен (Severozapaden),BG,Central and Eastern Europe,4.19,5800.00,11.10,72.10,448.70,98.00,20.70,39.00,41.30,62.00
|
240 |
+
Североизточен (Severoiztochen),BG,Central and Eastern Europe,6.19,6700.00,6.10,73.50,397.76,72.00,23.30,63.70,34.70,71.00
|
241 |
+
Югозападен (Yugozapaden),BG,Central and Eastern Europe,31.01,14800.00,3.50,74.50,444.85,45.00,43.40,103.70,22.70,71.00
|
242 |
+
Югоизточен (Yugoiztochen),BG,Central and Eastern Europe,6.36,6200.00,5.60,73.30,341.89,88.00,22.90,52.50,36.60,65.00
|
243 |
+
Южен централен (Yuzhen tsentralen),BG,Central and Eastern Europe,8.99,6400.00,4.00,73.90,403.78,55.00,21.90,63.70,37.70,63.00
|
pages/2_Analyses.py
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
|
4 |
+
sys.path.insert(1, os.path.abspath(".."))
|
5 |
+
import matplotlib as mpl
|
6 |
+
import matplotlib.pyplot as plt
|
7 |
+
import pandas as pd
|
8 |
+
import plotly.express as px
|
9 |
+
import streamlit as st
|
10 |
+
from statsmodels.stats.descriptivestats import describe
|
11 |
+
|
12 |
+
from stat_mod import *
|
13 |
+
|
14 |
+
# Set style of plots
|
15 |
+
plt.style.use("seaborn-whitegrid")
|
16 |
+
|
17 |
+
# Set plot resolution
|
18 |
+
mpl.rcParams["figure.dpi"] = 300
|
19 |
+
|
20 |
+
# Configure Streamlit page properties
|
21 |
+
st.set_page_config(page_title="Analyses📊", page_icon="📊")
|
22 |
+
|
23 |
+
# Page title
|
24 |
+
st.title("Statistical Analyses📊")
|
25 |
+
st.markdown(analysis_text, unsafe_allow_html=True)
|
26 |
+
|
27 |
+
# Read data CSV file
|
28 |
+
df = pd.read_csv("data/eu_region_data.csv")
|
29 |
+
num_cols = list(df.columns[3:])
|
30 |
+
|
31 |
+
# Define tabs on page
|
32 |
+
tab_str = [
|
33 |
+
"Descriptive Stats",
|
34 |
+
"Regression Model",
|
35 |
+
]
|
36 |
+
tab1, tab2 = st.tabs(tab_str)
|
37 |
+
|
38 |
+
with tab1:
|
39 |
+
st.markdown("##### Descriptive Stats for NUTS 2 Regional Data")
|
40 |
+
|
41 |
+
with st.expander("View NUTS 2 Regional Data"):
|
42 |
+
st.dataframe(df.style.format(precision=2))
|
43 |
+
st.write("This custom dataset was obtained using the EuroStat API.")
|
44 |
+
st.download_button(
|
45 |
+
"Download Dataset (CSV)",
|
46 |
+
df.to_csv(index=False, float_format="%.2f").encode("utf-8"),
|
47 |
+
"nuts2_dataset.csv",
|
48 |
+
"text/csv",
|
49 |
+
key="download-csv",
|
50 |
+
)
|
51 |
+
|
52 |
+
with st.expander("Summary Stats for NUTS 2 Regional Data"):
|
53 |
+
df_desc = describe(df, percentiles=[25, 75])
|
54 |
+
st.dataframe(df_desc.style.format(precision=2))
|
55 |
+
|
56 |
+
with st.expander("Distribution Plot for NUTS 2 Regional Data", expanded=True):
|
57 |
+
|
58 |
+
desc_cont = st.container()
|
59 |
+
col1, col2 = st.columns(2)
|
60 |
+
variable = col1.selectbox("Choose Variable: ", options=num_cols, index=1)
|
61 |
+
plot_type = col2.selectbox(
|
62 |
+
"Choose Plot: ", options=["Kernel Distribution Estimation Plot", "Box Plot"]
|
63 |
+
)
|
64 |
+
|
65 |
+
with desc_cont:
|
66 |
+
if plot_type == "Kernel Distribution Estimation Plot":
|
67 |
+
fig1 = kde_plt(df, variable)
|
68 |
+
st.pyplot(fig1)
|
69 |
+
|
70 |
+
elif plot_type == "Box Plot":
|
71 |
+
fig1 = box_plt(df, variable)
|
72 |
+
st.plotly_chart(fig1, use_container_width=True)
|
73 |
+
|
74 |
+
with st.expander("Correlation Heat Map for NUTS 2 Regional Data"):
|
75 |
+
fig = corr_heatmap(df)
|
76 |
+
st.pyplot(fig)
|
77 |
+
|
78 |
+
with tab2:
|
79 |
+
st.markdown("##### Regression Modelling for NUTS 2 Regional Data")
|
80 |
+
|
81 |
+
lin_reg_cont = st.container()
|
82 |
+
|
83 |
+
col3, col4 = st.columns(2)
|
84 |
+
col5, col6 = st.columns(2)
|
85 |
+
iv = col3.selectbox("Choose X: ", options=num_cols, index=1)
|
86 |
+
dv = col4.selectbox("Choose Y: ", options=num_cols, index=3)
|
87 |
+
model_dict = {"Linear Regression": "ols", "LOWESS": "lowess"}
|
88 |
+
model = col5.radio("Choose Model: ", options=model_dict.keys(), horizontal=True)
|
89 |
+
|
90 |
+
if model == "Linear Regression":
|
91 |
+
show_res = col6.checkbox("View Model Summary", value=False)
|
92 |
+
|
93 |
+
with lin_reg_cont:
|
94 |
+
fig2 = lin_reg_plt(df, iv, dv, model_dict[model])
|
95 |
+
st.plotly_chart(fig2, use_container_width=True)
|
96 |
+
|
97 |
+
if "show_res" in globals() and show_res == True:
|
98 |
+
summary = px.get_trendline_results(fig2).px_fit_results.iloc[0].summary()
|
99 |
+
st.write(summary)
|
requirements.txt
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
eurostatapiclient==0.2.7
|
2 |
+
plotly==5.7.0
|
3 |
+
streamlit==1.11.1
|
4 |
+
pandas==1.3.5
|
5 |
+
matplotlib==3.6.2
|
6 |
+
seaborn==0.11.1
|
7 |
+
statsmodels==0.12.2
|
8 |
+
patsy==0.5.1
|
9 |
+
numpy==1.22.4
|
10 |
+
scipy==1.6.2
|
stat_mod/__init__.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from stat_mod.data_opt import *
|
2 |
+
from stat_mod.datasets import *
|
3 |
+
from stat_mod.definitions import *
|
4 |
+
from stat_mod.figures import *
|
5 |
+
from stat_mod.text import *
|
6 |
+
from stat_mod.utils import *
|
stat_mod/__pycache__/__init__.cpython-38.pyc
ADDED
Binary file (327 Bytes). View file
|
|
stat_mod/__pycache__/data_opt.cpython-38.pyc
ADDED
Binary file (4.33 kB). View file
|
|
stat_mod/__pycache__/datasets.cpython-38.pyc
ADDED
Binary file (12.7 kB). View file
|
|
stat_mod/__pycache__/definitions.cpython-38.pyc
ADDED
Binary file (12.4 kB). View file
|
|
stat_mod/__pycache__/figure.cpython-38.pyc
ADDED
Binary file (4.14 kB). View file
|
|
stat_mod/__pycache__/figures.cpython-38.pyc
ADDED
Binary file (2.26 kB). View file
|
|
stat_mod/__pycache__/nuts2.cpython-38.pyc
ADDED
Binary file (12.4 kB). View file
|
|
stat_mod/__pycache__/options.cpython-38.pyc
ADDED
Binary file (4.46 kB). View file
|
|
stat_mod/__pycache__/text.cpython-38.pyc
ADDED
Binary file (924 Bytes). View file
|
|
stat_mod/__pycache__/text_elements.cpython-38.pyc
ADDED
Binary file (1.01 kB). View file
|
|
stat_mod/__pycache__/util_funcs.cpython-38.pyc
ADDED
Binary file (449 Bytes). View file
|
|
stat_mod/__pycache__/utils.cpython-38.pyc
ADDED
Binary file (455 Bytes). View file
|
|
stat_mod/definitions.py
ADDED
@@ -0,0 +1,480 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
countries = {
|
2 |
+
"Austria": "AT",
|
3 |
+
"Belgium": "BE",
|
4 |
+
"Bulgaria": "BG",
|
5 |
+
"Croatia": "HR",
|
6 |
+
"Cyprus": "CY",
|
7 |
+
"Czechia": "CZ",
|
8 |
+
"Denmark": "DK",
|
9 |
+
"Estonia": "EE",
|
10 |
+
"Finland": "FI",
|
11 |
+
"France": "FR",
|
12 |
+
"Germany": "DE",
|
13 |
+
"Greece": "EL",
|
14 |
+
"Hungary": "HU",
|
15 |
+
"Ireland": "IE",
|
16 |
+
"Italy": "IT",
|
17 |
+
"Latvia": "LV",
|
18 |
+
"Lithuania": "LT",
|
19 |
+
"Luxembourg": "LU",
|
20 |
+
"Malta": "MT",
|
21 |
+
"Netherlands": "NL",
|
22 |
+
"Poland": "PL",
|
23 |
+
"Portugal": "PT",
|
24 |
+
"Romania": "RO",
|
25 |
+
"Slovakia": "SK",
|
26 |
+
"Slovenia": "SI",
|
27 |
+
"Spain": "ES",
|
28 |
+
"Sweden": "SE",
|
29 |
+
}
|
30 |
+
|
31 |
+
countries_ISO3 = {
|
32 |
+
"AUT": " Austria",
|
33 |
+
"BEL": " Belgium",
|
34 |
+
"BGR": " Bulgaria",
|
35 |
+
"HRV": " Croatia",
|
36 |
+
"CYP": " Cyprus",
|
37 |
+
"CZE": " Czech Republic",
|
38 |
+
"DNK": " Denmark",
|
39 |
+
"EST": " Estonia",
|
40 |
+
"FIN": " Finland",
|
41 |
+
"FRA": " France",
|
42 |
+
"DEU": " Germany",
|
43 |
+
"GRC": " Greece",
|
44 |
+
"HUN": " Hungary",
|
45 |
+
"IRL": " Ireland",
|
46 |
+
"ITA": " Italy",
|
47 |
+
"LVA": " Latvia",
|
48 |
+
"LTU": " Lithuania",
|
49 |
+
"LUX": " Luxembourg",
|
50 |
+
"MLT": " Malta",
|
51 |
+
"NLD": " Netherlands",
|
52 |
+
"POL": " Poland",
|
53 |
+
"PRT": " Portugal",
|
54 |
+
"ROU": " Romania",
|
55 |
+
"SVK": " Slovakia",
|
56 |
+
"SVN": " Slovenia",
|
57 |
+
"ESP": " Spain",
|
58 |
+
"SWE": " Sweden",
|
59 |
+
}
|
60 |
+
|
61 |
+
nuts_codes = {
|
62 |
+
"AL": {
|
63 |
+
"AL01": "Veri",
|
64 |
+
"AL02": "Qender",
|
65 |
+
"AL03": "Jug",
|
66 |
+
"ALZZ": "Extra-Regio NUTS 2",
|
67 |
+
},
|
68 |
+
"AT": {
|
69 |
+
"AT11": "Burgenland",
|
70 |
+
"AT12": "Niederösterreich",
|
71 |
+
"AT13": "Wien",
|
72 |
+
"AT21": "Kärnten",
|
73 |
+
"AT22": "Steiermark",
|
74 |
+
"AT31": "Oberösterreich",
|
75 |
+
"AT32": "Salzburg",
|
76 |
+
"AT33": "Tirol",
|
77 |
+
"AT34": "Vorarlberg",
|
78 |
+
"ATZZ": "Extra-Regio NUTS 2",
|
79 |
+
},
|
80 |
+
"BE": {
|
81 |
+
"BE10": "Région de Bruxelles-Capitale/ Brussels Hoofdstedelijk Gewest",
|
82 |
+
"BE21": "Prov. Antwerpen",
|
83 |
+
"BE22": "Prov. Limburg (BE)",
|
84 |
+
"BE23": "Prov. Oost-Vlaanderen",
|
85 |
+
"BE24": "Prov. Vlaams-Brabant",
|
86 |
+
"BE25": "Prov. West-Vlaanderen",
|
87 |
+
"BE31": "Prov. Brabant Wallon",
|
88 |
+
"BE32": "Prov. Hainaut",
|
89 |
+
"BE33": "Prov. Liège",
|
90 |
+
"BE34": "Prov. Luxembourg (BE)",
|
91 |
+
"BE35": "Prov. Namur",
|
92 |
+
"BEZZ": "Extra-Regio NUTS 2",
|
93 |
+
},
|
94 |
+
"BG": {
|
95 |
+
"BG31": "Северозападен (Severozapaden)",
|
96 |
+
"BG32": "Северен централен (Severen tsentralen)",
|
97 |
+
"BG33": "Североизточен (Severoiztochen)",
|
98 |
+
"BG34": "Югоизточен (Yugoiztochen)",
|
99 |
+
"BG41": "Югозападен (Yugozapaden)",
|
100 |
+
"BG42": "Южен централен (Yuzhen tsentralen)",
|
101 |
+
"BGZZ": "Extra-Regio NUTS 2",
|
102 |
+
},
|
103 |
+
"CH": {
|
104 |
+
"CH01": "Région lémanique",
|
105 |
+
"CH02": "Espace Mittelland",
|
106 |
+
"CH03": "Nordwestschweiz",
|
107 |
+
"CH04": "Zürich",
|
108 |
+
"CH05": "Ostschweiz",
|
109 |
+
"CH06": "Zentralschweiz",
|
110 |
+
"CH07": "Ticino",
|
111 |
+
"CHZZ": "Extra-Regio NUTS 2",
|
112 |
+
},
|
113 |
+
"CY": {"CY00": "Κύπρος (Kypros)", "CYZZ": "Extra-Regio NUTS 2"},
|
114 |
+
"CZ": {
|
115 |
+
"CZ01": "Praha",
|
116 |
+
"CZ02": "Střední Čechy",
|
117 |
+
"CZ03": "Jihozápad",
|
118 |
+
"CZ04": "Severozápad",
|
119 |
+
"CZ05": "Severovýchod",
|
120 |
+
"CZ06": "Jihovýchod",
|
121 |
+
"CZ07": "Střední Morava",
|
122 |
+
"CZ08": "Moravskoslezsko",
|
123 |
+
"CZZZ": "Extra-Regio NUTS 2",
|
124 |
+
},
|
125 |
+
"DE": {
|
126 |
+
"DE11": "Stuttgart",
|
127 |
+
"DE12": "Karlsruhe",
|
128 |
+
"DE13": "Freiburg",
|
129 |
+
"DE14": "Tübingen",
|
130 |
+
"DE21": "Oberbayern",
|
131 |
+
"DE22": "Niederbayern",
|
132 |
+
"DE23": "Oberpfalz",
|
133 |
+
"DE24": "Oberfranken",
|
134 |
+
"DE25": "Mittelfranken",
|
135 |
+
"DE26": "Unterfranken",
|
136 |
+
"DE27": "Schwaben",
|
137 |
+
"DE30": "Berlin",
|
138 |
+
"DE40": "Brandenburg",
|
139 |
+
"DE50": "Bremen",
|
140 |
+
"DE60": "Hamburg",
|
141 |
+
"DE71": "Darmstadt",
|
142 |
+
"DE72": "Gießen",
|
143 |
+
"DE73": "Kassel",
|
144 |
+
"DE80": "Mecklenburg-Vorpommern",
|
145 |
+
"DE91": "Braunschweig",
|
146 |
+
"DE92": "Hannover",
|
147 |
+
"DE93": "Lüneburg",
|
148 |
+
"DE94": "Weser-Ems",
|
149 |
+
"DEA1": "Düsseldorf",
|
150 |
+
"DEA2": "Köln",
|
151 |
+
"DEA3": "Münster",
|
152 |
+
"DEA4": "Detmold",
|
153 |
+
"DEA5": "Arnsberg",
|
154 |
+
"DEB1": "Koblenz",
|
155 |
+
"DEB2": "Trier",
|
156 |
+
"DEB3": "Rheinhessen-Pfalz",
|
157 |
+
"DEC0": "Saarland",
|
158 |
+
"DED2": "Dresden",
|
159 |
+
"DED4": "Chemnitz",
|
160 |
+
"DED5": "Leipzig",
|
161 |
+
"DEE0": "Sachsen-Anhalt",
|
162 |
+
"DEF0": "Schleswig-Holstein",
|
163 |
+
"DEG0": "Thüringen",
|
164 |
+
"DEZZ": "Extra-Regio NUTS 2",
|
165 |
+
},
|
166 |
+
"DK": {
|
167 |
+
"DK01": "Hovedstaden",
|
168 |
+
"DK02": "Sjælland",
|
169 |
+
"DK03": "Syddanmark",
|
170 |
+
"DK04": "Midtjylland",
|
171 |
+
"DK05": "Nordjylland",
|
172 |
+
"DKZZ": "Extra-Regio NUTS 2",
|
173 |
+
},
|
174 |
+
"EE": {"EE00": "Eesti", "EEZZ": "Extra-Regio NUTS 2"},
|
175 |
+
"EL": {
|
176 |
+
"EL30": "Aττική (Attiki)",
|
177 |
+
"EL41": "Βόρειο Αιγαίο (Voreio Aigaio)",
|
178 |
+
"EL42": "Νότιο Αιγαίο (Notio Aigaio)",
|
179 |
+
"EL43": "Κρήτη (Kriti)",
|
180 |
+
"EL51": "Aνατολική Μακεδονία, Θράκη (Anatoliki Makedonia, Thraki)",
|
181 |
+
"EL52": "Κεντρική Μακεδονία (Kentriki Makedonia)",
|
182 |
+
"EL53": "Δυτική Μακεδονία (Dytiki Makedonia)",
|
183 |
+
"EL54": "Ήπειρος (Ipeiros)",
|
184 |
+
"EL61": "Θεσσαλία (Thessalia)",
|
185 |
+
"EL62": "Ιόνια Νησιά (Ionia Nisia)",
|
186 |
+
"EL63": "Δυτική Ελλάδα (Dytiki Ellada)",
|
187 |
+
"EL64": "Στερεά Ελλάδα (Sterea Ellada)",
|
188 |
+
"EL65": "Πελοπόννησος (Peloponnisos)",
|
189 |
+
"ELZZ": "Extra-Regio NUTS 2",
|
190 |
+
},
|
191 |
+
"ES": {
|
192 |
+
"ES11": "Galicia",
|
193 |
+
"ES12": "Principado de Asturias",
|
194 |
+
"ES13": "Cantabria",
|
195 |
+
"ES21": "País Vasco",
|
196 |
+
"ES22": "Comunidad Foral de Navarra",
|
197 |
+
"ES23": "La Rioja",
|
198 |
+
"ES24": "Aragón",
|
199 |
+
"ES30": "Comunidad de Madrid",
|
200 |
+
"ES41": "Castilla y León",
|
201 |
+
"ES42": "Castilla-La Mancha",
|
202 |
+
"ES43": "Extremadura",
|
203 |
+
"ES51": "Cataluña",
|
204 |
+
"ES52": "Comunitat Valenciana ",
|
205 |
+
"ES53": "Illes Balears",
|
206 |
+
"ES61": "Andalucía",
|
207 |
+
"ES62": "Región de Murcia",
|
208 |
+
"ES63": "Ciudad de Ceuta",
|
209 |
+
"ES64": "Ciudad de Melilla",
|
210 |
+
"ES70": "Canarias",
|
211 |
+
"ESZZ": "Extra-Regio NUTS 2",
|
212 |
+
},
|
213 |
+
"FI": {
|
214 |
+
"FI19": "Länsi-Suomi",
|
215 |
+
"FI1B": "Helsinki-Uusimaa",
|
216 |
+
"FI1C": "Etelä-Suomi",
|
217 |
+
"FI1D": "Pohjois- ja Itä-Suomi",
|
218 |
+
"FI20": "Åland",
|
219 |
+
"FIZZ": "Extra-Regio NUTS 2",
|
220 |
+
},
|
221 |
+
"FR": {
|
222 |
+
"FR10": "Ile-de-France",
|
223 |
+
"FRB0": "Centre — Val de Loire",
|
224 |
+
"FRC1": "Bourgogne",
|
225 |
+
"FRC2": "Franche-Comté",
|
226 |
+
"FRD1": "Basse-Normandie ",
|
227 |
+
"FRD2": "Haute-Normandie ",
|
228 |
+
"FRE1": "Nord-Pas de Calais",
|
229 |
+
"FRE2": "Picardie",
|
230 |
+
"FRF1": "Alsace",
|
231 |
+
"FRF2": "Champagne-Ardenne",
|
232 |
+
"FRF3": "Lorraine",
|
233 |
+
"FRG0": "Pays de la Loire",
|
234 |
+
"FRH0": "Bretagne",
|
235 |
+
"FRI1": "Aquitaine",
|
236 |
+
"FRI2": "Limousin",
|
237 |
+
"FRI3": "Poitou-Charentes",
|
238 |
+
"FRJ1": "Languedoc-Roussillon",
|
239 |
+
"FRJ2": "Midi-Pyrénées",
|
240 |
+
"FRK1": "Auvergne",
|
241 |
+
"FRK2": "Rhône-Alpes",
|
242 |
+
"FRL0": "Provence-Alpes-Côte d’Azur",
|
243 |
+
"FRM0": "Corse",
|
244 |
+
"FRY1": "Guadeloupe",
|
245 |
+
"FRY2": "Martinique ",
|
246 |
+
"FRY3": "Guyane",
|
247 |
+
"FRY4": "La Réunion ",
|
248 |
+
"FRY5": "Mayotte",
|
249 |
+
"FRZZ": "Extra-Regio NUTS 2",
|
250 |
+
},
|
251 |
+
"HR": {
|
252 |
+
"HR02": "Panonska Hrvatska",
|
253 |
+
"HR03": "Jadranska Hrvatska",
|
254 |
+
"HR05": "Grad Zagreb",
|
255 |
+
"HR06": "Sjeverna Hrvatska",
|
256 |
+
"HRZZ": "Extra-Regio NUTS 2",
|
257 |
+
},
|
258 |
+
"HU": {
|
259 |
+
"HU11": "Budapest",
|
260 |
+
"HU12": "Pest",
|
261 |
+
"HU21": "Közép-Dunántúl",
|
262 |
+
"HU22": "Nyugat-Dunántúl",
|
263 |
+
"HU23": "Dél-Dunántúl",
|
264 |
+
"HU31": "Észak-Magyarország",
|
265 |
+
"HU32": "Észak-Alföld",
|
266 |
+
"HU33": "Dél-Alföld",
|
267 |
+
"HUZZ": "Extra-Regio NUTS 2",
|
268 |
+
},
|
269 |
+
"IE": {
|
270 |
+
"IE04": "Northern and Western",
|
271 |
+
"IE05": "Southern",
|
272 |
+
"IE06": "Eastern and Midland",
|
273 |
+
"IEZZ": "Extra-Regio NUTS 2",
|
274 |
+
},
|
275 |
+
"IS": {"IS00": "Ísland", "ISZZ": "Extra-Regio NUTS 2"},
|
276 |
+
"IT": {
|
277 |
+
"ITC1": "Piemonte",
|
278 |
+
"ITC2": "Valle d’Aosta/Vallée d’Aoste",
|
279 |
+
"ITC3": "Liguria",
|
280 |
+
"ITC4": "Lombardia",
|
281 |
+
"ITF1": "Abruzzo",
|
282 |
+
"ITF2": "Molise",
|
283 |
+
"ITF3": "Campania",
|
284 |
+
"ITF4": "Puglia",
|
285 |
+
"ITF5": "Basilicata",
|
286 |
+
"ITF6": "Calabria",
|
287 |
+
"ITG1": "Sicilia",
|
288 |
+
"ITG2": "Sardegna",
|
289 |
+
"ITH1": "Provincia Autonoma di Bolzano/Bozen",
|
290 |
+
"ITH2": "Provincia Autonoma di Trento",
|
291 |
+
"ITH3": "Veneto",
|
292 |
+
"ITH4": "Friuli-Venezia Giulia",
|
293 |
+
"ITH5": "Emilia-Romagna",
|
294 |
+
"ITI1": "Toscana",
|
295 |
+
"ITI2": "Umbria",
|
296 |
+
"ITI3": "Marche",
|
297 |
+
"ITI4": "Lazio",
|
298 |
+
"ITZZ": "Extra-Regio NUTS 2",
|
299 |
+
},
|
300 |
+
"LI": {"LI00": "Liechtenstein", "LIZZ": "Extra-Regio NUTS 2"},
|
301 |
+
"LT": {
|
302 |
+
"LT01": "Sostinės regionas",
|
303 |
+
"LT02": "Vidurio ir vakarų Lietuvos regionas ",
|
304 |
+
"LTZZ": "Extra-Regio NUTS 2",
|
305 |
+
},
|
306 |
+
"LU": {"LU00": "Luxembourg", "LUZZ": "Extra-Regio NUTS 2"},
|
307 |
+
"LV": {"LV00": "Latvija", "LVZZ": "Extra-Regio NUTS 2"},
|
308 |
+
"ME": {"ME00": "Црна Гора", "MEZZ": "Extra-Regio NUTS 2"},
|
309 |
+
"MK": {"MK00": "Северна Македонија", "MKZZ": "Extra-Regio NUTS 2"},
|
310 |
+
"MT": {"MT00": "Malta", "MTZZ": "Extra-Regio NUTS 2"},
|
311 |
+
"NL": {
|
312 |
+
"NL11": "Groningen",
|
313 |
+
"NL12": "Friesland (NL)",
|
314 |
+
"NL13": "Drenthe",
|
315 |
+
"NL21": "Overijssel",
|
316 |
+
"NL22": "Gelderland",
|
317 |
+
"NL23": "Flevoland",
|
318 |
+
"NL31": "Utrecht",
|
319 |
+
"NL32": "Noord-Holland",
|
320 |
+
"NL33": "Zuid-Holland",
|
321 |
+
"NL34": "Zeeland",
|
322 |
+
"NL41": "Noord-Brabant",
|
323 |
+
"NL42": "Limburg (NL)",
|
324 |
+
"NLZZ": "Extra-Regio NUTS 2",
|
325 |
+
},
|
326 |
+
"NO": {
|
327 |
+
"NO02": "Innlandet",
|
328 |
+
"NO06": "Trøndelag",
|
329 |
+
"NO07": "Nord-Norge",
|
330 |
+
"NO08": "Oslo og Viken",
|
331 |
+
"NO09": "Agder og Sør-Østlandet",
|
332 |
+
"NO0A": "Vestlandet",
|
333 |
+
"NO0B": "Jan Mayen and Svalbard",
|
334 |
+
"NOZZ": "Extra-Regio NUTS 2",
|
335 |
+
},
|
336 |
+
"PL": {
|
337 |
+
"PL21": "Małopolskie",
|
338 |
+
"PL22": "Śląskie",
|
339 |
+
"PL41": "Wielkopolskie",
|
340 |
+
"PL42": "Zachodniopomorskie",
|
341 |
+
"PL43": "Lubuskie",
|
342 |
+
"PL51": "Dolnośląskie",
|
343 |
+
"PL52": "Opolskie",
|
344 |
+
"PL61": "Kujawsko-pomorskie",
|
345 |
+
"PL62": "Warmińsko-mazurskie",
|
346 |
+
"PL63": "Pomorskie",
|
347 |
+
"PL71": "Łódzkie",
|
348 |
+
"PL72": "Świętokrzyskie",
|
349 |
+
"PL81": "Lubelskie",
|
350 |
+
"PL82": "Podkarpackie",
|
351 |
+
"PL84": "Podlaskie",
|
352 |
+
"PL91": "Warszawski stołeczny",
|
353 |
+
"PL92": "Mazowiecki regionalny",
|
354 |
+
"PLZZ": "Extra-Regio NUTS 2",
|
355 |
+
},
|
356 |
+
"PT": {
|
357 |
+
"PT11": "Norte",
|
358 |
+
"PT15": "Algarve",
|
359 |
+
"PT16": "Centro (PT)",
|
360 |
+
"PT17": "Área Metropolitana de Lisboa",
|
361 |
+
"PT18": "Alentejo",
|
362 |
+
"PT20": "Região Autónoma dos Açores",
|
363 |
+
"PT30": "Região Autónoma da Madeira",
|
364 |
+
"PTZZ": "Extra-Regio NUTS 2",
|
365 |
+
},
|
366 |
+
"RO": {
|
367 |
+
"RO11": "Nord-Vest",
|
368 |
+
"RO12": "Centru",
|
369 |
+
"RO21": "Nord-Est",
|
370 |
+
"RO22": "Sud-Est",
|
371 |
+
"RO31": "Sud-Muntenia",
|
372 |
+
"RO32": "Bucureşti-Ilfov",
|
373 |
+
"RO41": "Sud-Vest Oltenia",
|
374 |
+
"RO42": "Vest",
|
375 |
+
"ROZZ": "Extra-Regio NUTS 2",
|
376 |
+
},
|
377 |
+
"RS": {
|
378 |
+
"RS11": "Београдски регион",
|
379 |
+
"RS12": "Регион Војводине",
|
380 |
+
"RS21": "Регион Шумадије и Западне Србије",
|
381 |
+
"RS22": "Регион Јужне и Источне Србије",
|
382 |
+
"RSZZ": "Extra-Regio NUTS 2",
|
383 |
+
},
|
384 |
+
"SE": {
|
385 |
+
"SE11": "Stockholm",
|
386 |
+
"SE12": "Östra Mellansverige",
|
387 |
+
"SE21": "Småland med öarna",
|
388 |
+
"SE22": "Sydsverige",
|
389 |
+
"SE23": "Västsverige",
|
390 |
+
"SE31": "Norra Mellansverige",
|
391 |
+
"SE32": "Mellersta Norrland",
|
392 |
+
"SE33": "Övre Norrland",
|
393 |
+
"SEZZ": "Extra-Regio NUTS 2",
|
394 |
+
},
|
395 |
+
"SI": {
|
396 |
+
"SI03": "Vzhodna Slovenija",
|
397 |
+
"SI04": "Zahodna Slovenija",
|
398 |
+
"SIZZ": "Extra-Regio NUTS 2",
|
399 |
+
},
|
400 |
+
"SK": {
|
401 |
+
"SK01": "Bratislavský kraj",
|
402 |
+
"SK02": "Západné Slovensko",
|
403 |
+
"SK03": "Stredné Slovensko",
|
404 |
+
"SK04": "Východné Slovensko",
|
405 |
+
"SKZZ": "Extra-Regio NUTS 2",
|
406 |
+
},
|
407 |
+
"TR": {
|
408 |
+
"TR10 ": "İstanbul",
|
409 |
+
"TR21": "Tekirdağ, Edirne, Kırklareli",
|
410 |
+
"TR22": "Balıkesir, Çanakkale",
|
411 |
+
"TR31": "İzmir",
|
412 |
+
"TR32": "Aydın, Denizli, Muğla",
|
413 |
+
"TR33": "Manisa, Afyonkarahisar, Kütahya, Uşak",
|
414 |
+
"TR41": "Bursa, Eskişehir, Bilecik",
|
415 |
+
"TR42": "Kocaeli, Sakarya, Düzce, Bolu, Yalova",
|
416 |
+
"TR51": "Ankara",
|
417 |
+
"TR52": "Konya, Karaman",
|
418 |
+
"TR61": "Antalya, Isparta, Burdur",
|
419 |
+
"TR62": "Adana, Mersin",
|
420 |
+
"TR63": "Hatay, Kahramanmaraş, Osmaniye",
|
421 |
+
"TR71": "Kırıkkale, Aksaray, Niğde, Nevşehir, Kırşehir",
|
422 |
+
"TR72": "Kayseri, Sivas, Yozgat",
|
423 |
+
"TR81": "Zonguldak, Karabük, Bartın",
|
424 |
+
"TR82": "Kastamonu, Çankırı, Sinop",
|
425 |
+
"TR83": "Samsun, Tokat, Çorum, Amasya",
|
426 |
+
"TR90 ": "Trabzon, Ordu, Giresun, Rize, Artvin, Gümüşhane",
|
427 |
+
"TRA1": "Erzurum, Erzincan, Bayburt",
|
428 |
+
"TRA2": "Ağrı, Kars, Iğdır, Ardahan",
|
429 |
+
"TRB1": "Malatya, Elazığ, Bingöl, Tunceli",
|
430 |
+
"TRB2": "Van, Muş, Bitlis, Hakkari",
|
431 |
+
"TRC1": "Gaziantep, Adıyaman, Kilis",
|
432 |
+
"TRC2": "Şanlıurfa, Diyarbakır",
|
433 |
+
"TRC3": "Mardin, Batman, Şırnak, Siirt",
|
434 |
+
"TRZZ": "Extra-Regio NUTS 2",
|
435 |
+
},
|
436 |
+
"UK": {
|
437 |
+
"UKC1": "Tees Valley and Durham",
|
438 |
+
"UKC2": "Northumberland and Tyne and Wear",
|
439 |
+
"UKD1": "Cumbria",
|
440 |
+
"UKD3": "Greater Manchester",
|
441 |
+
"UKD4": "Lancashire",
|
442 |
+
"UKD6": "Cheshire",
|
443 |
+
"UKD7": "Merseyside",
|
444 |
+
"UKE1": "East Yorkshire and Northern Lincolnshire",
|
445 |
+
"UKE2": "North Yorkshire",
|
446 |
+
"UKE3": "South Yorkshire",
|
447 |
+
"UKE4": "West Yorkshire",
|
448 |
+
"UKF1": "Derbyshire and Nottinghamshire",
|
449 |
+
"UKF2": "Leicestershire, Rutland and Northamptonshire",
|
450 |
+
"UKF3": "Lincolnshire",
|
451 |
+
"UKG1": "Herefordshire, Worcestershire and Warwickshire",
|
452 |
+
"UKG2": "Shropshire and Staffordshire",
|
453 |
+
"UKG3": "West Midlands",
|
454 |
+
"UKH1": "East Anglia",
|
455 |
+
"UKH2": "Bedfordshire and Hertfordshire",
|
456 |
+
"UKH3": "Essex",
|
457 |
+
"UKI3": "Inner London — West",
|
458 |
+
"UKI4": "Inner London — East",
|
459 |
+
"UKI5": "Outer London — East and North East",
|
460 |
+
"UKI6": "Outer London — South",
|
461 |
+
"UKI7": "Outer London — West and North West",
|
462 |
+
"UKJ1": "Berkshire, Buckinghamshire and Oxfordshire",
|
463 |
+
"UKJ2": "Surrey, East and West Sussex",
|
464 |
+
"UKJ3": "Hampshire and Isle of Wight",
|
465 |
+
"UKJ4": "Kent",
|
466 |
+
"UKK1": "Gloucestershire, Wiltshire and Bristol/Bath area",
|
467 |
+
"UKK2": "Dorset and Somerset",
|
468 |
+
"UKK3": "Cornwall and Isles of Scilly",
|
469 |
+
"UKK4": "Devon",
|
470 |
+
"UKL1": "West Wales and The Valleys",
|
471 |
+
"UKL2": "East Wales",
|
472 |
+
"UKM5": "North Eastern Scotland",
|
473 |
+
"UKM6": "Highlands and Islands",
|
474 |
+
"UKM7": "Eastern Scotland",
|
475 |
+
"UKM8": "West Central Scotland",
|
476 |
+
"UKM9": "Southern Scotland",
|
477 |
+
"UKN0": "Northern Ireland",
|
478 |
+
"UKZZ": "Extra-Regio NUTS 2",
|
479 |
+
},
|
480 |
+
}
|
stat_mod/figures.py
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import matplotlib.pyplot as plt
|
2 |
+
import plotly.express as px
|
3 |
+
import seaborn as sns
|
4 |
+
|
5 |
+
from .definitions import *
|
6 |
+
|
7 |
+
## Functions for plotting ##
|
8 |
+
def lin_reg_plt(df, x, y, model):
|
9 |
+
"""Create linear regression plot.
|
10 |
+
|
11 |
+
Returns:
|
12 |
+
plotly.graph_objects
|
13 |
+
"""
|
14 |
+
if model == "lowess":
|
15 |
+
trendline_options = dict(frac=0.6)
|
16 |
+
else:
|
17 |
+
trendline_options = None
|
18 |
+
|
19 |
+
# Plotly scatter plot for the data points
|
20 |
+
fig = px.scatter(
|
21 |
+
df,
|
22 |
+
x=x,
|
23 |
+
y=y,
|
24 |
+
trendline=model,
|
25 |
+
height=400,
|
26 |
+
trendline_options=trendline_options,
|
27 |
+
hover_data=["region_name"],
|
28 |
+
trendline_color_override=px.colors.qualitative.D3[3],
|
29 |
+
color_discrete_sequence=px.colors.qualitative.D3,
|
30 |
+
)
|
31 |
+
|
32 |
+
fig.update_layout(
|
33 |
+
plot_bgcolor="white",
|
34 |
+
legend=dict(orientation="h", title=""),
|
35 |
+
margin=dict(l=1, r=1, t=18, b=1, pad=1),
|
36 |
+
)
|
37 |
+
|
38 |
+
return fig
|
39 |
+
|
40 |
+
|
41 |
+
def box_plt(df, variable):
|
42 |
+
"""Create Plotly box plot.
|
43 |
+
|
44 |
+
Returns:
|
45 |
+
plotly.graph_objects
|
46 |
+
"""
|
47 |
+
fig = px.box(
|
48 |
+
df,
|
49 |
+
x="EU Region",
|
50 |
+
y=variable,
|
51 |
+
points="all",
|
52 |
+
color_discrete_sequence=px.colors.qualitative.D3,
|
53 |
+
hover_data=["region_name"],
|
54 |
+
notched=True,
|
55 |
+
title="",
|
56 |
+
color="EU Region",
|
57 |
+
height=400,
|
58 |
+
)
|
59 |
+
|
60 |
+
fig.update_layout(
|
61 |
+
margin=dict(l=1, r=1, t=23, b=1, pad=1),
|
62 |
+
plot_bgcolor="white",
|
63 |
+
showlegend=False,
|
64 |
+
yaxis_title="",
|
65 |
+
xaxis_title="",
|
66 |
+
)
|
67 |
+
return fig
|
68 |
+
|
69 |
+
|
70 |
+
def kde_plt(df, variable):
|
71 |
+
"""Create kernel density estimation plot.
|
72 |
+
|
73 |
+
Returns:
|
74 |
+
plotly.graph_objects
|
75 |
+
"""
|
76 |
+
fig, ax = plt.subplots(figsize=(10, 6))
|
77 |
+
|
78 |
+
ax.grid(False)
|
79 |
+
ax.spines["top"].set_visible(False)
|
80 |
+
ax.spines["right"].set_visible(False)
|
81 |
+
ax.spines["bottom"].set_visible(False)
|
82 |
+
ax.spines["left"].set_visible(False)
|
83 |
+
ax.get_yaxis().set_ticks([])
|
84 |
+
|
85 |
+
sns.kdeplot(data=df, x=variable, fill=True, alpha=0.15, hue="EU Region", ax=ax)
|
86 |
+
|
87 |
+
return fig
|
88 |
+
|
89 |
+
|
90 |
+
def corr_heatmap(df):
|
91 |
+
"""Create correlation heat map."""
|
92 |
+
fig, ax = plt.subplots(figsize=(10, 8))
|
93 |
+
|
94 |
+
sns.heatmap(df.corr().round(decimals=2), annot=True, ax=ax)
|
95 |
+
|
96 |
+
return fig
|
stat_mod/text.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
intro_text = """Welcome to the EU Data Explorer. This is a small dashboard app displaying data for EU countries sourced from [EuroStat](https://ec.europa.eu/eurostat/web/nuts/background). Statistical analyses and simple regression modelling is showcased in the Analyses page."""
|
2 |
+
|
3 |
+
|
4 |
+
analysis_text = """
|
5 |
+
The app page presents statistical analyses of data for administrative regions in
|
6 |
+
EU countries ([NUTS 2](https://ec.europa.eu/eurostat/web/nuts/background) level).
|
7 |
+
The **Descriptive Stats** tab includes the dataset, summary statistics and visualizations.
|
8 |
+
Additionally, the **Regression Model** tab provides linear regression or [LOWESS](https://blogs.sas.com/content/iml/2016/10/17/what-is-loess-regression.html) modelling
|
9 |
+
by selecting the variables of your preference.
|
10 |
+
"""
|