{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Analisis Completo — Turismo Internacional en Espana 2025\n", "\n", "Integracion de datos INE (tabla 2078 por ciudad) con el dataset FRONTUR/EGATUR/Turespaña.\n", "\n", "**Fuentes:** INE Encuesta Ocupacion Hotelera, FRONTUR, EGATUR, Turespaña ESTI, Skyscanner" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CSVs disponibles: ['01_FRONTUR_2025_anual_paises.csv', '02_FRONTUR_dic2025_paises.csv', '03_FRONTUR_2025_destino_ccaa.csv', '04_FRONTUR_2025_mensual.csv', '05_EGATUR_2025_gasto_paises.csv', '06_FRONTUR_serie_historica_anual.csv', '07_FRONTUR_2025_alojamiento.csv', '08_encuesta_satisfaccion_turistas.csv', '09_satisfaccion_por_pais.csv', '10_motivaciones_elegir_espana.csv', '11_factores_experienciales.csv', '12_fuentes_inspiracion_viaje.csv', '13_imagen_espana_mercados.csv', '14_evolucion_motivaciones_vs_2019.csv', '15_satisfaccion_por_motivo_viaje.csv', '16_gasto_ccaa_acumulado.csv']\n" ] } ], "source": [ "import pandas as pd\n", "import plotly.express as px\n", "import plotly.graph_objects as go\n", "from plotly.subplots import make_subplots\n", "from pathlib import Path\n", "import os\n", "\n", "VAULT = Path(os.environ.get('FN_REGISTRY_ROOT', '../..')) / 'vaults' / 'turismo_spain'\n", "RAW = VAULT / 'raw'\n", "FUENTES = RAW / 'turismo-espana-2025' / 'fuentes'\n", "print(f'CSVs disponibles: {sorted([f.name for f in FUENTES.glob(\"*.csv\")])}')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Panorama general — Record historico 96.8M turistas" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": [ "#636EFA", "#636EFA", "#636EFA", "#636EFA", "#636EFA", "#636EFA", "#EF553B" ] }, "text": [ "83.5M", "18.9M", "31.2M", "71.7M", "85.2M", "93.8M", "96.8M" ], "textposition": "outside", "type": "bar", "x": { "bdata": "4wfkB+UH5gfnB+gH6Qc=", "dtype": "i2" }, "y": { "bdata": "AAAAAADgVEBmZmZmZuYyQDMzMzMzMz9AzczMzMzsUUDNzMzMzExVQDMzMzMzc1dAMzMzMzMzWEA=", "dtype": "f8" } } ], "layout": { "height": 400, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "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" } ], "scattermap": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermap" } ], "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": "Turistas internacionales en Espana (2019-2025)" }, "xaxis": { "title": { "text": "Anio" } }, "yaxis": { "range": [ 0, 110 ], "title": { "text": "Millones de turistas" } } } } }, "metadata": {}, "output_type": "display_data", "transient": {} }, { "name": "stdout", "output_type": "stream", "text": [ "Recuperacion post-COVID: de 18.9M (2020) a 96.8M (2025)\n", "Crecimiento vs pre-pandemia 2019: 15.9%\n" ] } ], "source": [ "# Serie historica\n", "serie = pd.read_csv(FUENTES / '06_FRONTUR_serie_historica_anual.csv')\n", "\n", "fig = go.Figure()\n", "fig.add_trace(go.Bar(\n", " x=serie['anio'], y=serie['turistas_millones'],\n", " text=serie['turistas_millones'].apply(lambda x: f'{x}M'),\n", " textposition='outside',\n", " marker_color=['#636EFA' if a != 2025 else '#EF553B' for a in serie['anio']]\n", "))\n", "fig.update_layout(\n", " title='Turistas internacionales en Espana (2019-2025)',\n", " yaxis_title='Millones de turistas',\n", " xaxis_title='Anio',\n", " height=400,\n", " yaxis_range=[0, 110]\n", ")\n", "fig.show()\n", "\n", "print(f'Recuperacion post-COVID: de {serie[serie.anio==2020].turistas_millones.values[0]}M (2020) a {serie[serie.anio==2025].turistas_millones.values[0]}M (2025)')\n", "print(f'Crecimiento vs pre-pandemia 2019: {((96.8/83.5)-1)*100:.1f}%')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Paises emisores — De donde vienen los turistas" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "branchvalues": "total", "customdata": [ [ "19.7", 3.6999999999999997 ], [ "13.2", -1 ], [ "12.4", 0.6 ], [ "5.9", 4.4 ], [ "5.4", 0.9000000000000001 ], [ "5.2", 3.3 ], [ "10.0", 6.3 ], [ "4.6", 4.3 ], [ "5.5", 3.2 ], [ "3.1", 10.1 ], [ "3.2", 0 ], [ "3.5", 12.999999999999998 ], [ "2.4", 6.4 ], [ "6.0", 3.7 ] ], "domain": { "x": [ 0, 1 ], "y": [ 0, 1 ] }, "hovertemplate": "labels=%{label}
turistas_millones=%{value}
parent=%{parent}
id=%{id}
cuota_pct=%{customdata[0]}
variacion_anual_pct=%{color}", "ids": [ "Reino Unido", "Francia", "Alemania", "Italia", "Paises Nordicos", "Paises Bajos", "Resto de Europa", "Estados Unidos", "Resto de America", "Irlanda", "Belgica", "Portugal", "Suiza", "Resto del mundo" ], "labels": [ "Reino Unido", "Francia", "Alemania", "Italia", "Paises Nordicos", "Paises Bajos", "Resto de Europa", "Estados Unidos", "Resto de America", "Irlanda", "Belgica", "Portugal", "Suiza", "Resto del mundo" ], "marker": { "coloraxis": "coloraxis", "colors": { "bdata": "mZmZmZmZDUAAAAAAAADwvzMzMzMzM+M/mpmZmZmZEUDOzMzMzMzsP2ZmZmZmZgpAMzMzMzMzGUAzMzMzMzMRQJqZmZmZmQlAMzMzMzMzJEAAAAAAAAAAAP///////ylAmpmZmZmZGUCamZmZmZkNQA==", "dtype": "f8" } }, "name": "", "parents": [ "", "", "", "", "", "", "", "", "", "", "", "", "", "" ], "type": "treemap", "values": { "bdata": "mpmZmZkZM0CamZmZmZkpQAAAAAAAAChAzczMzMzMFkDNzMzMzMwUQAAAAAAAABRAZmZmZmZmI0AAAAAAAAASQDMzMzMzMxVAAAAAAAAACEDNzMzMzMwIQDMzMzMzMwtAZmZmZmZmAkAzMzMzMzMXQA==", "dtype": "f8" } } ], "layout": { "coloraxis": { "cmid": 3.2, "colorbar": { "title": { "text": "variacion_anual_pct" } }, "colorscale": [ [ 0, "rgb(165,0,38)" ], [ 0.1, "rgb(215,48,39)" ], [ 0.2, "rgb(244,109,67)" ], [ 0.3, "rgb(253,174,97)" ], [ 0.4, "rgb(254,224,139)" ], [ 0.5, "rgb(255,255,191)" ], [ 0.6, "rgb(217,239,139)" ], [ 0.7, "rgb(166,217,106)" ], [ 0.8, "rgb(102,189,99)" ], [ 0.9, "rgb(26,152,80)" ], [ 1, "rgb(0,104,55)" ] ] }, "height": 500, "legend": { "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "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" } ], "scattermap": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermap" } ], "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": "Turistas por pais de origen 2025 (tamaño=volumen, color=crecimiento %)" } } } }, "metadata": {}, "output_type": "display_data", "transient": {} }, { "name": "stdout", "output_type": "stream", "text": [ "Top 5 emisores:\n", " Reino Unido 19.1M (+3.7%) — 19.7% del total\n", " Francia 12.8M (-1.0%) — 13.2% del total\n", " Alemania 12.0M (+0.6%) — 12.4% del total\n", " Italia 5.7M (+4.4%) — 5.9% del total\n", " Paises Nordicos 5.2M (+0.9%) — 5.4% del total\n" ] } ], "source": [ "# Turistas por pais\n", "paises = pd.read_csv(FUENTES / '01_FRONTUR_2025_anual_paises.csv')\n", "paises_sin_total = paises[paises['pais'] != 'TOTAL'].copy()\n", "\n", "fig = px.treemap(\n", " paises_sin_total,\n", " path=['pais'],\n", " values='turistas_millones',\n", " color='variacion_anual_pct',\n", " color_continuous_scale='RdYlGn',\n", " color_continuous_midpoint=3.2,\n", " title='Turistas por pais de origen 2025 (tamaño=volumen, color=crecimiento %)',\n", " hover_data=['cuota_pct']\n", ")\n", "fig.update_layout(height=500)\n", "fig.show()\n", "\n", "print('Top 5 emisores:')\n", "for _, r in paises_sin_total.head(5).iterrows():\n", " signo = '+' if r['variacion_anual_pct'] > 0 else ''\n", " print(f' {r[\"pais\"]:20s} {r[\"turistas_millones\"]:5.1f}M ({signo}{r[\"variacion_anual_pct\"]}%) — {r[\"cuota_pct\"]}% del total')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Dinamica mensual 2025\n", "mensual = pd.read_csv(FUENTES / '04_FRONTUR_2025_mensual.csv')\n", "\n", "fig = make_subplots(specs=[[{'secondary_y': True}]])\n", "fig.add_trace(\n", " go.Bar(x=mensual['mes'], y=mensual['turistas_millones'], name='Turistas (M)', marker_color='#636EFA'),\n", " secondary_y=False\n", ")\n", "fig.add_trace(\n", " go.Scatter(x=mensual['mes'], y=mensual['variacion_anual_pct'], name='Variacion %', \n", " mode='lines+markers', marker_color='#EF553B', line_width=2),\n", " secondary_y=True\n", ")\n", "fig.update_layout(title='Llegadas mensuales 2025 y variacion interanual', height=400)\n", "fig.update_yaxes(title_text='Millones', secondary_y=False)\n", "fig.update_yaxes(title_text='Variacion %', secondary_y=True)\n", "fig.show()\n", "\n", "pico = mensual.loc[mensual['turistas_millones'].idxmax()]\n", "print(f'Mes pico: {pico[\"mes\"]} con {pico[\"turistas_millones\"]}M turistas')\n", "print(f'Mayor crecimiento interanual: {mensual.loc[mensual[\"variacion_anual_pct\"].idxmax()][\"mes\"]} ({mensual[\"variacion_anual_pct\"].max()}%)')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Destinos — CCAA y gasto" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# CCAA destino\n", "ccaa = pd.read_csv(FUENTES / '03_FRONTUR_2025_destino_ccaa.csv')\n", "ccaa_sin_total = ccaa[ccaa['ccaa'] != 'TOTAL'].sort_values('turistas_millones', ascending=True)\n", "\n", "fig = go.Figure()\n", "fig.add_trace(go.Bar(\n", " x=ccaa_sin_total['turistas_millones'],\n", " y=ccaa_sin_total['ccaa'],\n", " orientation='h',\n", " text=ccaa_sin_total.apply(lambda r: f\"{r['turistas_millones']}M ({r['cuota_pct']}%)\", axis=1),\n", " textposition='outside',\n", " marker_color=ccaa_sin_total['variacion_anual_pct'].apply(\n", " lambda x: '#2ecc71' if x > 3.2 else '#3498db' if x > 0 else '#e74c3c'\n", " )\n", "))\n", "fig.update_layout(\n", " title='Turistas por CCAA destino 2025 (verde=crece por encima de media, azul=por debajo)',\n", " xaxis_title='Millones de turistas',\n", " height=400, xaxis_range=[0, 24]\n", ")\n", "fig.show()\n", "\n", "print('Crecimiento por CCAA:')\n", "for _, r in ccaa_sin_total.sort_values('variacion_anual_pct', ascending=False).iterrows():\n", " print(f' {r[\"ccaa\"]:25s} +{r[\"variacion_anual_pct\"]}%')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Gasto total (M EUR)=%{x}
Gasto medio/turista (EUR)=%{y}
% del gasto total=%{marker.size}
pais=%{text}", "legendgroup": "", "marker": { "color": "#636efa", "size": { "bdata": "mpmZmZmZMUBmZmZmZmYnQDMzMzMzMyFAAAAAAAAAFEBmZmZmZmYOQM3MzMzMzAhAzczMzMzMDEDNzMzMzMz8P2ZmZmZmZv4/mpmZmZmZ+T9mZmZmZmb2Pw==", "dtype": "f8" }, "sizemode": "area", "sizeref": 0.044000000000000004, "symbol": "circle" }, "mode": "markers+text", "name": "", "orientation": "v", "showlegend": false, "text": [ "Reino Unido", "Alemania", "Francia", "Estados Unidos", "Paises Nordicos", "Paises Bajos", "Italia", "Belgica", "Suiza", "Irlanda", "Portugal" ], "textposition": "top center", "type": "scatter", "x": { "bdata": "YlzXPV0tkBrsE2gQwBJgCSgKNAhsBw==", "dtype": "i2" }, "xaxis": "x", "y": { "bdata": "AAAAAABYk0AAAAAAAJyUQAAAAAAAWIxAAAAAAACcl0AAAAAAAKiOQAAAAAAAQIpAAAAAAABQikAAAAAAADCIQAAAAAAAqJFAAAAAAADghUAAAAAAAHiBQA==", "dtype": "f8" }, "yaxis": "y" } ], "layout": { "height": 500, "legend": { "itemsizing": "constant", "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "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" } ], "scattermap": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermap" } ], "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": "Gasto total vs gasto medio por turista — por pais emisor" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Gasto total (M EUR)" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "Gasto medio/turista (EUR)" } } } } }, "metadata": {}, "output_type": "display_data", "transient": {} }, { "name": "stdout", "output_type": "stream", "text": [ "Gasto medio por turista (top):\n", " Estados Unidos 1,511 EUR/turista\n", " Alemania 1,319 EUR/turista\n", " Reino Unido 1,238 EUR/turista\n", " Suiza 1,130 EUR/turista\n", " Paises Nordicos 981 EUR/turista\n" ] } ], "source": [ "# Gasto por pais emisor\n", "gasto = pd.read_csv(FUENTES / '05_EGATUR_2025_gasto_paises.csv')\n", "gasto_paises = gasto[(gasto['pais'] != 'TOTAL') & (gasto['pais'] != 'Resto')].copy()\n", "\n", "fig = px.scatter(\n", " gasto_paises,\n", " x='gasto_total_millones_eur',\n", " y='gasto_medio_por_turista_eur_aprox',\n", " text='pais',\n", " size='cuota_gasto_pct',\n", " title='Gasto total vs gasto medio por turista — por pais emisor',\n", " labels={\n", " 'gasto_total_millones_eur': 'Gasto total (M EUR)',\n", " 'gasto_medio_por_turista_eur_aprox': 'Gasto medio/turista (EUR)',\n", " 'cuota_gasto_pct': '% del gasto total'\n", " }\n", ")\n", "fig.update_traces(textposition='top center')\n", "fig.update_layout(height=500)\n", "fig.show()\n", "\n", "print('Gasto medio por turista (top):')\n", "for _, r in gasto_paises.sort_values('gasto_medio_por_turista_eur_aprox', ascending=False).head(5).iterrows():\n", " print(f' {r[\"pais\"]:20s} {r[\"gasto_medio_por_turista_eur_aprox\"]:,.0f} EUR/turista')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Alojamiento — Donde se hospedan" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "domain": { "x": [ 0, 1 ], "y": [ 0, 1 ] }, "hole": 0.4, "hovertemplate": "tipo=%{label}
turistas_acum2025=%{value}", "labels": [ "Hotelero", "Vivienda alquiler", "Resto", "Vivienda propiedad", "Familiares/amigos", "Resto" ], "legendgroup": "", "name": "", "showlegend": true, "type": "pie", "values": { "bdata": "a2vDA2rguACtXUAAhlZRANJrogD5LRQA", "dtype": "i4" } } ], "layout": { "height": 400, "legend": { "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "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" } ], "scattermap": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermap" } ], "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": "Tipo de alojamiento de turistas extranjeros 2025" } } } }, "metadata": {}, "output_type": "display_data", "transient": {} }, { "name": "stdout", "output_type": "stream", "text": [ "Desglose:\n", " Hotelero 63,138,667 (65.2%) — variacion: +1.9%\n", " Vivienda alquiler 12,116,074 (12.5%) — variacion: +5.3%\n", " Familiares/amigos 10,644,434 (11.0%) — variacion: +4.3%\n", " Vivienda propiedad 5,330,566 (5.5%) — variacion: +8.5%\n", " Resto 4,218,285 (4.4%) — variacion: +6.0%\n", " Resto 1,322,489 (1.4%) — variacion: +12.3%\n" ] } ], "source": [ "# Tipo de alojamiento\n", "aloj = pd.read_csv(FUENTES / '07_FRONTUR_2025_alojamiento.csv')\n", "aloj_detalle = aloj[aloj['tipo_alojamiento'].str.contains(' - ') & ~aloj['tipo_alojamiento'].str.contains('Total')].copy()\n", "aloj_detalle['tipo'] = aloj_detalle['tipo_alojamiento'].str.split(' - ').str[-1]\n", "aloj_detalle['pct'] = (aloj_detalle['turistas_acum2025'] / 96770515 * 100).round(1)\n", "\n", "fig = px.pie(\n", " aloj_detalle,\n", " values='turistas_acum2025',\n", " names='tipo',\n", " title='Tipo de alojamiento de turistas extranjeros 2025',\n", " hole=0.4\n", ")\n", "fig.update_layout(height=400)\n", "fig.show()\n", "\n", "print('Desglose:')\n", "for _, r in aloj_detalle.sort_values('turistas_acum2025', ascending=False).iterrows():\n", " print(f' {r[\"tipo\"]:25s} {r[\"turistas_acum2025\"]:>12,} ({r[\"pct\"]}%) — variacion: {r[\"variacion_anual_pct\"]:+.1f}%')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5. Satisfaccion y motivaciones — Por que eligen Espana" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "hovertemplate": "Porcentaje (%)=%{marker.color}
=%{y}", "legendgroup": "", "marker": { "color": { "bdata": "MzMzMzMzKUBmZmZmZmYvQAAAAAAAADpAAAAAAAAAP0AAAAAAAIBLQAAAAAAAAExAAAAAAAAATkA=", "dtype": "f8" }, "coloraxis": "coloraxis", "pattern": { "shape": "" } }, "name": "", "orientation": "h", "showlegend": false, "textposition": "auto", "type": "bar", "x": { "bdata": "MzMzMzMzKUBmZmZmZmYvQAAAAAAAADpAAAAAAAAAP0AAAAAAAIBLQAAAAAAAAExAAAAAAAAATkA=", "dtype": "f8" }, "xaxis": "x", "y": [ "Visita familiares/amigos", "Cultura", "Clima", "Comida/bebida en destino", "Precio alojamiento", "Precio vuelos", "Coste economico (media mundial)" ], "yaxis": "y" } ], "layout": { "barmode": "relative", "coloraxis": { "colorbar": { "title": { "text": "Porcentaje (%)" } }, "colorscale": [ [ 0, "rgb(243, 231, 155)" ], [ 0.16666666666666666, "rgb(250, 196, 132)" ], [ 0.3333333333333333, "rgb(248, 160, 126)" ], [ 0.5, "rgb(235, 127, 134)" ], [ 0.6666666666666666, "rgb(206, 102, 147)" ], [ 0.8333333333333334, "rgb(160, 89, 160)" ], [ 1, "rgb(92, 83, 165)" ] ], "showscale": false }, "height": 400, "legend": { "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "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": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "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" } ], "scattermap": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermap" } ], "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": "Motivaciones para elegir Espana como destino" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "Porcentaje (%)" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "" } } } } }, "metadata": {}, "output_type": "display_data", "transient": {} }, { "name": "stdout", "output_type": "stream", "text": [ "Evolucion de motivaciones vs 2019:\n", " Motivos culturales +32\n", " Motivos gastronomicos +28\n", " Media conjunto motivaciones inferior a cultural y gastro\n" ] } ], "source": [ "# Motivaciones\n", "motiv = pd.read_csv(FUENTES / '10_motivaciones_elegir_espana.csv')\n", "motiv_num = motiv[motiv['porcentaje'].apply(lambda x: str(x).replace('.','').replace(',','').replace('%','').strip().isdigit())].copy()\n", "motiv_num['pct'] = motiv_num['porcentaje'].astype(float)\n", "\n", "fig = px.bar(\n", " motiv_num.sort_values('pct', ascending=True),\n", " x='pct', y='motivacion', orientation='h',\n", " title='Motivaciones para elegir Espana como destino',\n", " labels={'pct': 'Porcentaje (%)', 'motivacion': ''},\n", " color='pct', color_continuous_scale='Sunset'\n", ")\n", "fig.update_layout(height=400, coloraxis_showscale=False)\n", "fig.show()\n", "\n", "# Evolucion motivaciones vs 2019\n", "evol = pd.read_csv(FUENTES / '14_evolucion_motivaciones_vs_2019.csv')\n", "print('Evolucion de motivaciones vs 2019:')\n", "for _, r in evol.iterrows():\n", " print(f' {r[\"motivacion\"]:40s} {r[\"crecimiento_vs_2019_pct\"]}')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Satisfaccion por pais\n", "satis = pd.read_csv(FUENTES / '09_satisfaccion_por_pais.csv')\n", "satis_clean = satis[satis['pct_muy_satisfechos'].notna()].copy()\n", "\n", "fig = px.bar(\n", " satis_clean.sort_values('pct_muy_satisfechos', ascending=True),\n", " x='pct_muy_satisfechos', y='pais_origen', orientation='h',\n", " title='% Muy satisfechos por pais de origen',\n", " labels={'pct_muy_satisfechos': '% Muy satisfechos', 'pais_origen': ''},\n", " color='pct_muy_satisfechos', color_continuous_scale='Greens'\n", ")\n", "fig.update_layout(height=400, coloraxis_showscale=False)\n", "fig.show()\n", "\n", "# Imagen de Espana\n", "imagen = pd.read_csv(FUENTES / '13_imagen_espana_mercados.csv')\n", "print('\\nImagen de Espana en mercados emisores:')\n", "for _, r in imagen.iterrows():\n", " print(f' {r[\"atributo\"]:35s} [{r[\"relevancia\"]}]')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6. Cruce con datos INE por ciudad — Vision integrada" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Cargar INE tabla 2078\n", "df = pd.read_csv(RAW / 'ine_2078_viajeros_puntos_turisticos.csv', sep=';', encoding='utf-8-sig')\n", "df[['cod_municipio', 'ciudad']] = df['Puntos turísticos'].str.extract(r'^(\\d+)\\s+(.*)')\n", "df['fecha'] = pd.to_datetime(df['Periodo'].str.replace('M', '-'), format='%Y-%m')\n", "df['anio'] = df['fecha'].dt.year\n", "df['mes'] = df['fecha'].dt.month\n", "df['valor'] = pd.to_numeric(df['Total'].str.replace('.', '', regex=False), errors='coerce')\n", "\n", "# Mapeo ciudad -> CCAA (aproximado para las principales)\n", "ciudad_ccaa = {\n", " 'Barcelona': 'Cataluna', 'Lloret de Mar': 'Cataluna', 'Salou': 'Cataluna',\n", " 'Madrid': 'Comunidad de Madrid',\n", " 'Palma': 'Illes Balears', 'Calvià': 'Illes Balears', 'Sóller': 'Illes Balears',\n", " 'Sevilla': 'Andalucia', 'Málaga': 'Andalucia', 'Granada': 'Andalucia',\n", " 'Torremolinos': 'Andalucia', 'Marbella': 'Andalucia',\n", " 'València': 'Comunitat Valenciana', 'Benidorm': 'Comunitat Valenciana', 'Altea': 'Comunitat Valenciana',\n", " 'San Bartolomé de Tirajana': 'Canarias', 'Adeje': 'Canarias', 'Arona': 'Canarias',\n", " 'Pájara': 'Canarias', 'Yaiza': 'Canarias', 'Mogán': 'Canarias',\n", " 'Donostia/San Sebastián': 'Resto CCAA', 'Bilbao': 'Resto CCAA',\n", "}\n", "\n", "ext_2025 = df[\n", " (df['Residencia'] == 'Residentes en el Extranjero') &\n", " (df['Viajeros y pernoctaciones'] == 'Viajero') &\n", " (df['anio'] == 2025)\n", "].copy()\n", "\n", "top20 = ext_2025.groupby('ciudad')['valor'].sum().sort_values(ascending=False).head(20)\n", "top20_df = top20.reset_index()\n", "top20_df.columns = ['ciudad', 'viajeros_ext']\n", "top20_df['ccaa'] = top20_df['ciudad'].map(ciudad_ccaa).fillna('Otro')\n", "\n", "fig = px.bar(\n", " top20_df.sort_values('viajeros_ext', ascending=True),\n", " x='viajeros_ext', y='ciudad', color='ccaa', orientation='h',\n", " title='Top 20 ciudades por turismo extranjero 2025 (coloreadas por CCAA)',\n", " labels={'viajeros_ext': 'Viajeros extranjeros', 'ciudad': '', 'ccaa': 'CCAA'}\n", ")\n", "fig.update_layout(height=600)\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 7. Resumen ejecutivo integrado" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print('=' * 70)\n", "print(' TURISMO INTERNACIONAL EN ESPANA 2025 — RESUMEN EJECUTIVO')\n", "print('=' * 70)\n", "\n", "print(f'''\n", "CIFRAS CLAVE\n", " Turistas totales: 96.8M (+3.2% vs 2024) — RECORD HISTORICO\n", " Gasto total: 134,710M EUR (+6.8% vs 2024)\n", " Gasto medio/turista: 1,391 EUR\n", " Satisfaccion: 97% satisfechos, 66.2% muy satisfechos\n", " Repeticion: 69% intencion de volver en 12 meses\n", "\n", "PAISES EMISORES (Top 5)\n", " 1. Reino Unido 19.1M (+3.7%) — 19.7% del total — gasto 1,238 EUR/turista\n", " 2. Francia 12.8M (-1.0%) — 13.2% del total — gasto 907 EUR/turista\n", " 3. Alemania 12.0M (+0.6%) — 12.4% del total — gasto 1,319 EUR/turista\n", " 4. Italia 5.7M (+4.4%) — 5.9% del total — gasto 842 EUR/turista\n", " 5. Paises Nordicos 5.2M (+0.9%) — 5.4% del total — gasto 981 EUR/turista\n", " Turistas mas valiosos: USA (1,511 EUR/turista), Alemania (1,319), UK (1,238)\n", "\n", "DESTINOS CCAA\n", " Cataluna lidera en volumen (20.1M) pero crece poco (+0.6%)\n", " Andalucia es la que mas crece (+6.6%) y ya alcanza 14.5M\n", " Canarias e Illes Balears empatan en 15.7M cada una\n", "\n", "CIUDADES (datos hoteleros INE)\n", " Barcelona (7.4M) y Madrid (6.1M) concentran la mayor afluencia\n", " Islas dominan posiciones 3-7: Palma, Calvia, San Bartolome, Adeje\n", " Mayor crecimiento: Algeciras (+35%), Badajoz (+30%), Murcia (+24%), Malaga (+17%)\n", "\n", "POR QUE ELIGEN ESPANA\n", " Clima (26%) + Cultura (15.7%) + Visita familiares (12.6%)\n", " Cultura crece +32% y gastronomia +28% vs 2019\n", " Latinoamerica: los mas satisfechos (Mexico 79.5%, Brasil 79.4%)\n", "\n", "ALOJAMIENTO\n", " 65.3% hotelero (63.1M) — pero crece solo +1.9%\n", " Vivienda alquiler: 12.1M (+5.3%) — presion creciente\n", " Familiares/amigos: 10.6M (+4.3%)\n", " Vivienda propia: 5.3M (+8.5%) — mayor crecimiento\n", "''')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.13.7" } }, "nbformat": 4, "nbformat_minor": 4 }