diff --git a/analysis.ipynb b/analysis.ipynb
new file mode 100644
index 0000000..3b4a58a
--- /dev/null
+++ b/analysis.ipynb
@@ -0,0 +1,22379 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Land Registry Price Paid Data Analysis\n",
+ "\n",
+ "Analysis of UK property transactions from HM Land Registry, with focus on London."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "polars.config.Config"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import polars as pl\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",
+ "\n",
+ "pl.Config.set_tbl_rows(20)\n",
+ "pl.Config.set_fmt_str_lengths(50)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Schema: Schema({'transaction_id': String, 'price': Int64, 'date_of_transfer': Datetime(time_unit='us', time_zone=None), 'postcode': String, 'property_type': String, 'old_new': String, 'duration': String, 'paon': String, 'saon': String, 'street': String, 'locality': String, 'town_city': String, 'district': String, 'county': String, 'ppd_category': String, 'record_status': String})\n"
+ ]
+ }
+ ],
+ "source": [
+ "DATA_PATH = Path(\"./data_sources/pp-complete.parquet\")\n",
+ "lf = pl.scan_parquet(DATA_PATH)\n",
+ "print(f\"Schema: {lf.collect_schema()}\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "PROPERTY_TYPE_MAP = {\n",
+ " \"D\": \"Detached\",\n",
+ " \"S\": \"Semi-detached\",\n",
+ " \"T\": \"Terraced\",\n",
+ " \"F\": \"Flat/Maisonette\",\n",
+ " \"O\": \"Other\",\n",
+ "}\n",
+ "TENURE_MAP = {\"F\": \"Freehold\", \"L\": \"Leasehold\"}\n",
+ "NEW_OLD_MAP = {\"Y\": \"New Build\", \"N\": \"Existing\"}\n",
+ "LONDON_FILTER = pl.col(\"county\") == \"GREATER LONDON\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 1. Overview & Basic Statistics"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Total transactions: 30,813,304\n",
+ "London transactions: 3,908,410 (12.7%)\n"
+ ]
+ }
+ ],
+ "source": [
+ "row_count = lf.select(pl.len()).collect().item()\n",
+ "london_count = lf.filter(LONDON_FILTER).select(pl.len()).collect().item()\n",
+ "print(f\"Total transactions: {row_count:,}\")\n",
+ "print(f\"London transactions: {london_count:,} ({london_count/row_count*100:.1f}%)\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Date range: 1995-01-01 00:00:00 to 2025-11-28 00:00:00\n"
+ ]
+ }
+ ],
+ "source": [
+ "date_stats = lf.select(\n",
+ " pl.col(\"date_of_transfer\").min().alias(\"earliest\"),\n",
+ " pl.col(\"date_of_transfer\").max().alias(\"latest\"),\n",
+ ").collect()\n",
+ "print(f\"Date range: {date_stats['earliest'][0]} to {date_stats['latest'][0]}\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "=== National Price Statistics ===\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "
shape: (1, 7)| min | max | mean | median | p25 | p75 | p95 |
|---|
| i64 | i64 | f64 | f64 | f64 | f64 | f64 |
| 1 | 900000000 | 233512.848852 | 157000.0 | 88500.0 | 260000.0 | 580000.0 |
"
+ ],
+ "text/plain": [
+ "shape: (1, 7)\n",
+ "┌─────┬───────────┬───────────────┬──────────┬─────────┬──────────┬──────────┐\n",
+ "│ min ┆ max ┆ mean ┆ median ┆ p25 ┆ p75 ┆ p95 │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ i64 ┆ i64 ┆ f64 ┆ f64 ┆ f64 ┆ f64 ┆ f64 │\n",
+ "╞═════╪═══════════╪═══════════════╪══════════╪═════════╪══════════╪══════════╡\n",
+ "│ 1 ┆ 900000000 ┆ 233512.848852 ┆ 157000.0 ┆ 88500.0 ┆ 260000.0 ┆ 580000.0 │\n",
+ "└─────┴───────────┴───────────────┴──────────┴─────────┴──────────┴──────────┘"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "=== London Price Statistics ===\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (1, 7)| min | max | mean | median | p25 | p75 | p95 |
|---|
| i64 | i64 | f64 | f64 | f64 | f64 | f64 |
| 1 | 793020000 | 435285.860816 | 253000.0 | 150000.0 | 450000.0 | 1.0528e6 |
"
+ ],
+ "text/plain": [
+ "shape: (1, 7)\n",
+ "┌─────┬───────────┬───────────────┬──────────┬──────────┬──────────┬──────────┐\n",
+ "│ min ┆ max ┆ mean ┆ median ┆ p25 ┆ p75 ┆ p95 │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ i64 ┆ i64 ┆ f64 ┆ f64 ┆ f64 ┆ f64 ┆ f64 │\n",
+ "╞═════╪═══════════╪═══════════════╪══════════╪══════════╪══════════╪══════════╡\n",
+ "│ 1 ┆ 793020000 ┆ 435285.860816 ┆ 253000.0 ┆ 150000.0 ┆ 450000.0 ┆ 1.0528e6 │\n",
+ "└─────┴───────────┴───────────────┴──────────┴──────────┴──────────┴──────────┘"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "def get_price_stats(lazy_frame):\n",
+ " return lazy_frame.select(\n",
+ " pl.col(\"price\").min().alias(\"min\"),\n",
+ " pl.col(\"price\").max().alias(\"max\"),\n",
+ " pl.col(\"price\").mean().alias(\"mean\"),\n",
+ " pl.col(\"price\").median().alias(\"median\"),\n",
+ " pl.col(\"price\").quantile(0.25).alias(\"p25\"),\n",
+ " pl.col(\"price\").quantile(0.75).alias(\"p75\"),\n",
+ " pl.col(\"price\").quantile(0.95).alias(\"p95\"),\n",
+ " ).collect()\n",
+ "\n",
+ "print(\"=== National Price Statistics ===\")\n",
+ "display(get_price_stats(lf))\n",
+ "print(\"\\n=== London Price Statistics ===\")\n",
+ "display(get_price_stats(lf.filter(LONDON_FILTER)))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "name": "National",
+ "type": "bar",
+ "x": [
+ "Terraced",
+ "Semi-detached",
+ "Detached",
+ "Flat/Maisonette",
+ "Other"
+ ],
+ "xaxis": "x",
+ "y": {
+ "bdata": "73+LABVQgAARcmwAtLdUAK8yCQA=",
+ "dtype": "u4"
+ },
+ "yaxis": "y"
+ },
+ {
+ "marker": {
+ "color": "crimson"
+ },
+ "name": "London",
+ "type": "bar",
+ "x": [
+ "Flat/Maisonette",
+ "Terraced",
+ "Semi-detached",
+ "Detached",
+ "Other"
+ ],
+ "xaxis": "x2",
+ "y": {
+ "bdata": "yUIeAC7sEADAuwgAtpwCAM0bAQA=",
+ "dtype": "u4"
+ },
+ "yaxis": "y2"
+ }
+ ],
+ "layout": {
+ "annotations": [
+ {
+ "font": {
+ "size": 16
+ },
+ "showarrow": false,
+ "text": "National",
+ "x": 0.225,
+ "xanchor": "center",
+ "xref": "paper",
+ "y": 1,
+ "yanchor": "bottom",
+ "yref": "paper"
+ },
+ {
+ "font": {
+ "size": 16
+ },
+ "showarrow": false,
+ "text": "London",
+ "x": 0.775,
+ "xanchor": "center",
+ "xref": "paper",
+ "y": 1,
+ "yanchor": "bottom",
+ "yref": "paper"
+ }
+ ],
+ "height": 400,
+ "showlegend": false,
+ "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": "Property Type Distribution"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 0.45
+ ]
+ },
+ "xaxis2": {
+ "anchor": "y2",
+ "domain": [
+ 0.55,
+ 1
+ ]
+ },
+ "yaxis": {
+ "anchor": "x",
+ "domain": [
+ 0,
+ 1
+ ]
+ },
+ "yaxis2": {
+ "anchor": "x2",
+ "domain": [
+ 0,
+ 1
+ ]
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "def get_property_types(lazy_frame):\n",
+ " return (\n",
+ " lazy_frame.group_by(\"property_type\")\n",
+ " .agg(pl.len().alias(\"count\"))\n",
+ " .sort(\"count\", descending=True)\n",
+ " .with_columns(pl.col(\"property_type\").replace(PROPERTY_TYPE_MAP).alias(\"type_name\"))\n",
+ " .collect()\n",
+ " )\n",
+ "\n",
+ "property_types_national = get_property_types(lf)\n",
+ "property_types_london = get_property_types(lf.filter(LONDON_FILTER))\n",
+ "\n",
+ "fig = make_subplots(rows=1, cols=2, subplot_titles=(\"National\", \"London\"))\n",
+ "fig.add_trace(go.Bar(x=property_types_national[\"type_name\"], y=property_types_national[\"count\"], name=\"National\"), row=1, col=1)\n",
+ "fig.add_trace(go.Bar(x=property_types_london[\"type_name\"], y=property_types_london[\"count\"], name=\"London\", marker_color=\"crimson\"), row=1, col=2)\n",
+ "fig.update_layout(title_text=\"Property Type Distribution\", showlegend=False, height=400)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "domain": {
+ "x": [
+ 0,
+ 0.45
+ ],
+ "y": [
+ 0,
+ 1
+ ]
+ },
+ "labels": [
+ "U",
+ "Leasehold",
+ "Freehold"
+ ],
+ "name": "National",
+ "type": "pie",
+ "values": {
+ "bdata": "FAIAAPG5bgBzcGcB",
+ "dtype": "u4"
+ }
+ },
+ {
+ "domain": {
+ "x": [
+ 0.55,
+ 1
+ ],
+ "y": [
+ 0,
+ 1
+ ]
+ },
+ "labels": [
+ "Freehold",
+ "U",
+ "Leasehold"
+ ],
+ "name": "London",
+ "type": "pie",
+ "values": {
+ "bdata": "6VQcAFwAAAD1TR8A",
+ "dtype": "u4"
+ }
+ }
+ ],
+ "layout": {
+ "annotations": [
+ {
+ "font": {
+ "size": 16
+ },
+ "showarrow": false,
+ "text": "National",
+ "x": 0.225,
+ "xanchor": "center",
+ "xref": "paper",
+ "y": 1,
+ "yanchor": "bottom",
+ "yref": "paper"
+ },
+ {
+ "font": {
+ "size": 16
+ },
+ "showarrow": false,
+ "text": "London",
+ "x": 0.775,
+ "xanchor": "center",
+ "xref": "paper",
+ "y": 1,
+ "yanchor": "bottom",
+ "yref": "paper"
+ }
+ ],
+ "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": "Freehold vs Leasehold"
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "def get_tenure(lazy_frame):\n",
+ " return (\n",
+ " lazy_frame.group_by(\"duration\")\n",
+ " .agg(pl.len().alias(\"count\"))\n",
+ " .with_columns(pl.col(\"duration\").replace(TENURE_MAP).alias(\"tenure_name\"))\n",
+ " .collect()\n",
+ " )\n",
+ "\n",
+ "tenure_national = get_tenure(lf)\n",
+ "tenure_london = get_tenure(lf.filter(LONDON_FILTER))\n",
+ "\n",
+ "fig = make_subplots(rows=1, cols=2, specs=[[{\"type\": \"pie\"}, {\"type\": \"pie\"}]], subplot_titles=(\"National\", \"London\"))\n",
+ "fig.add_trace(go.Pie(labels=tenure_national[\"tenure_name\"], values=tenure_national[\"count\"], name=\"National\"), row=1, col=1)\n",
+ "fig.add_trace(go.Pie(labels=tenure_london[\"tenure_name\"], values=tenure_london[\"count\"], name=\"London\"), row=1, col=2)\n",
+ "fig.update_layout(title_text=\"Freehold vs Leasehold\", height=400)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 2. Geographic Analysis"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "Transactions=%{x}
County=%{y}
Avg Price=%{marker.color}",
+ "legendgroup": "",
+ "marker": {
+ "color": {
+ "bdata": "PMJ5cVeRGkGoyQZGgZUDQQJiBitLnQJBjKs1DSh5BEEh9OMPqIUOQW3mWJ3o2A5B3ek5X+VnEEGheLT5y3ABQdedcUsGwxdB3+eTIqzsAUGN62wCYIQTQfkANY2LPwFB75pMbPBTAUH8DfWeCA0HQSrm9a5CjhBB7Z9wCZScC0E4cJj71tIDQQs4DqY3SgNB+wq1KJTEBUFLtTaa6OEDQQ==",
+ "dtype": "f8"
+ },
+ "coloraxis": "coloraxis",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "",
+ "orientation": "h",
+ "showlegend": false,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "OqM7AO3yFAD/4hEAktcRAOlaDQB8Bg0AvzUMADDDCgDaewoAnwYKAFTRCQDXwwkARkgIAO8rCAByHAgAZ7oHANEQBwBS8wYAk74GAFq5BgA=",
+ "dtype": "u4"
+ },
+ "xaxis": "x",
+ "y": [
+ "GREATER LONDON",
+ "GREATER MANCHESTER",
+ "WEST YORKSHIRE",
+ "WEST MIDLANDS",
+ "KENT",
+ "ESSEX",
+ "HAMPSHIRE",
+ "LANCASHIRE",
+ "SURREY",
+ "MERSEYSIDE",
+ "HERTFORDSHIRE",
+ "SOUTH YORKSHIRE",
+ "TYNE AND WEAR",
+ "NORFOLK",
+ "WEST SUSSEX",
+ "DEVON",
+ "NOTTINGHAMSHIRE",
+ "LINCOLNSHIRE",
+ "STAFFORDSHIRE",
+ "DERBYSHIRE"
+ ],
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "barmode": "relative",
+ "coloraxis": {
+ "colorbar": {
+ "title": {
+ "text": "Avg Price"
+ }
+ },
+ "colorscale": [
+ [
+ 0,
+ "rgb(247,251,255)"
+ ],
+ [
+ 0.125,
+ "rgb(222,235,247)"
+ ],
+ [
+ 0.25,
+ "rgb(198,219,239)"
+ ],
+ [
+ 0.375,
+ "rgb(158,202,225)"
+ ],
+ [
+ 0.5,
+ "rgb(107,174,214)"
+ ],
+ [
+ 0.625,
+ "rgb(66,146,198)"
+ ],
+ [
+ 0.75,
+ "rgb(33,113,181)"
+ ],
+ [
+ 0.875,
+ "rgb(8,81,156)"
+ ],
+ [
+ 1,
+ "rgb(8,48,107)"
+ ]
+ ]
+ },
+ "height": 600,
+ "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": "Top 20 Counties by Transaction Volume"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Transactions"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "categoryorder": "total ascending",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "County"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "top_counties = (\n",
+ " lf.group_by(\"county\")\n",
+ " .agg(pl.len().alias(\"count\"), pl.col(\"price\").mean().alias(\"avg_price\"))\n",
+ " .sort(\"count\", descending=True)\n",
+ " .head(20)\n",
+ " .collect()\n",
+ ")\n",
+ "\n",
+ "fig = px.bar(top_counties.to_pandas(), x=\"count\", y=\"county\", orientation=\"h\",\n",
+ " title=\"Top 20 Counties by Transaction Volume\",\n",
+ " color=\"avg_price\", color_continuous_scale=\"Blues\",\n",
+ " labels={\"count\": \"Transactions\", \"county\": \"County\", \"avg_price\": \"Avg Price\"})\n",
+ "fig.update_layout(yaxis={\"categoryorder\": \"total ascending\"}, height=600)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "Transactions=9997
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "9997",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "9997",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "QpxSfpbOQEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CITY OF LONDON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=136514
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "136514",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "136514",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "/CSbqtvbMkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CITY OF WESTMINSTER"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=95701
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "95701",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "95701",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "TrVGQyALMkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "KENSINGTON AND CHELSEA"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=94598
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "94598",
+ "marker": {
+ "color": "#ab63fa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "94598",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "5KZvOd/TKEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CAMDEN"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=96510
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "96510",
+ "marker": {
+ "color": "#FFA15A",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "96510",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "8zZ2i8kdI0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HAMMERSMITH AND FULHAM"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=86743
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "86743",
+ "marker": {
+ "color": "#19d3f3",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "86743",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "lB/sSL1wIUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "ISLINGTON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=118226
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "118226",
+ "marker": {
+ "color": "#FF6692",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "118226",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "zBhSe50JIEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "RICHMOND UPON THAMES"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=205569
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "205569",
+ "marker": {
+ "color": "#B6E880",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "205569",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "KwB4l9KPHkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "WANDSWORTH"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=132363
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "132363",
+ "marker": {
+ "color": "#FF97FF",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "132363",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "HV3QYUIEHUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "TOWER HAMLETS"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=126267
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "126267",
+ "marker": {
+ "color": "#FECB52",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "126267",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "YIBrkxB2HEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "SOUTHWARK"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=87769
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "87769",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "87769",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "SzRPNffgGkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HACKNEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=167945
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "167945",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "167945",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "9nkNfxHbGUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BARNET"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=148758
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "148758",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "148758",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "uh6DkLXGGEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "LAMBETH"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=106941
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "106941",
+ "marker": {
+ "color": "#ab63fa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "106941",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "kBE4qn1gGEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "MERTON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=102836
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "102836",
+ "marker": {
+ "color": "#FFA15A",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "102836",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "6hYvQ0C5F0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HARINGEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=138063
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "138063",
+ "marker": {
+ "color": "#19d3f3",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "138063",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "wVDPb6xLF0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "EALING"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=102767
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "102767",
+ "marker": {
+ "color": "#FF6692",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "102767",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "wkYlNPEoF0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BRENT"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=91858
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "91858",
+ "marker": {
+ "color": "#B6E880",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "91858",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "29UgdfiLFkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "KINGSTON UPON THAMES"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=105166
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "105166",
+ "marker": {
+ "color": "#FF97FF",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "105166",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "ZKXUTqLVFUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HOUNSLOW"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=182749
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "182749",
+ "marker": {
+ "color": "#FECB52",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "182749",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "ME7NgBVaFEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BROMLEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=96332
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "96332",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "96332",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "PY658DNAFEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HARROW"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=128205
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "128205",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "128205",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "hC3JOuDfE0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HILLINGDON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=118947
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "118947",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "118947",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "LLDAAkt9E0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "GREENWICH"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=135137
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "135137",
+ "marker": {
+ "color": "#ab63fa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "135137",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "adJBBt2xEUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "LEWISHAM"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=107884
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "107884",
+ "marker": {
+ "color": "#FFA15A",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "107884",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "d8X0DFOGEUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "NEWHAM"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=139100
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "139100",
+ "marker": {
+ "color": "#19d3f3",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "139100",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "VzmlzOdsEUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "ENFIELD"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=121830
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "121830",
+ "marker": {
+ "color": "#FF6692",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "121830",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "bsmiyxv+EEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "REDBRIDGE"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=182962
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "182962",
+ "marker": {
+ "color": "#B6E880",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "182962",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "v+UVB9LlEEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CROYDON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=116771
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "116771",
+ "marker": {
+ "color": "#FF97FF",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "116771",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "20u9XWrIEEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "WALTHAM FOREST"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=110499
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "110499",
+ "marker": {
+ "color": "#FECB52",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "110499",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "RmmAX56xEEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "SUTTON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=120683
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "120683",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "120683",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "MKAMQLqqEEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HAVERING"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=120065
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "120065",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "120065",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "SfDKNdPmDUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BEXLEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Transactions=72655
Average Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "72655",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "72655",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "1qYFhGVFCkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BARKING AND DAGENHAM"
+ ],
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "barmode": "relative",
+ "height": 800,
+ "legend": {
+ "title": {
+ "text": "Transactions"
+ },
+ "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": "London Boroughs by Average Price"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Average Price (£)"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "categoryorder": "total ascending",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Borough"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "london_boroughs = (\n",
+ " lf.filter(LONDON_FILTER)\n",
+ " .group_by(\"district\")\n",
+ " .agg(pl.len().alias(\"count\"), pl.col(\"price\").mean().alias(\"avg_price\"), pl.col(\"price\").median().alias(\"median_price\"))\n",
+ " .sort(\"avg_price\", descending=True)\n",
+ " .collect()\n",
+ ")\n",
+ "\n",
+ "fig = px.bar(london_boroughs.to_pandas(), x=\"avg_price\", y=\"district\", orientation=\"h\",\n",
+ " title=\"London Boroughs by Average Price\",\n",
+ " color=\"count\", color_continuous_scale=\"Reds\",\n",
+ " labels={\"avg_price\": \"Average Price (£)\", \"district\": \"Borough\", \"count\": \"Transactions\"})\n",
+ "fig.update_layout(yaxis={\"categoryorder\": \"total ascending\"}, height=800)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 3. Time Series Analysis"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def get_yearly_stats(lazy_frame):\n",
+ " return (\n",
+ " lazy_frame.with_columns(pl.col(\"date_of_transfer\").dt.year().alias(\"year\"))\n",
+ " .group_by(\"year\")\n",
+ " .agg(pl.len().alias(\"count\"), pl.col(\"price\").mean().alias(\"avg_price\"), pl.col(\"price\").median().alias(\"median_price\"))\n",
+ " .sort(\"year\")\n",
+ " .collect()\n",
+ " )\n",
+ "\n",
+ "yearly_national = get_yearly_stats(lf)\n",
+ "yearly_london = get_yearly_stats(lf.filter(LONDON_FILTER))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "mode": "lines+markers",
+ "name": "National",
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "y": {
+ "bdata": "E+yfBquW8EDMB79XHHbxQJKMPfOLLfNANCZ1DJbc9ECsHlSHR3P3QOvy1jfSPvpA3t+GDE4H/UDrnEgmcNcAQSjypGgMCANByuT1PxnXBUG02NOcyh4HQdpLcpUE2QhBb0S4KebHCkGX3vh7vYEKQRquJAA3DQpBSJ7V4hjSDEHpvEVPxGsMQbEp66ozGg1BUFVKDdtdD0FxgKQM5hcRQZCCb6ybJxJBLV2RzLwlE0E5aFz+gSsVQTZURmLtdxVBsmXadLCuFUF7NTOdkw4XQfBlxjoIxBdBROWiw9RGGUGwUZfRaMEYQQyUcuswJBhBqfr+nV1wFkE=",
+ "dtype": "f8"
+ }
+ },
+ {
+ "line": {
+ "color": "crimson"
+ },
+ "mode": "lines+markers",
+ "name": "London",
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "y": {
+ "bdata": "LNaj3vvd90DQtlE+KsH5QHglR64OSP1ActAj4Nt/AEGCfV8g/VgDQaNulTO0DQdBZU3JPd4FCUEQetloL30MQdY0iWihsQ5BI1AJiTXUEEHWn8FfirsRQTYA8SP5TBNBFatIgjWLFUELQjS94BkWQSmI3PWlJBZB198HTBzsGEGjF593D8QZQTjYqOdcwBpBmHypCPZKH0EEaJ3FkOchQc3/7rUjpiNBROnuIdNLJUE6h4KGxE8oQRMHwHfvEClBvHK72KqRKUGH68fsSwwqQUNHVzsSbShBn387+IktKkFGivowWR8qQYV+M7HZjyhBXYmtoAilJUE=",
+ "dtype": "f8"
+ }
+ }
+ ],
+ "layout": {
+ "height": 500,
+ "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": "Average Price by Year"
+ },
+ "xaxis": {
+ "title": {
+ "text": "Year"
+ }
+ },
+ "yaxis": {
+ "title": {
+ "text": "Average Price (£)"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "fig = go.Figure()\n",
+ "fig.add_trace(go.Scatter(x=yearly_national[\"year\"], y=yearly_national[\"avg_price\"], name=\"National\", mode=\"lines+markers\"))\n",
+ "fig.add_trace(go.Scatter(x=yearly_london[\"year\"], y=yearly_london[\"avg_price\"], name=\"London\", mode=\"lines+markers\", line=dict(color=\"crimson\")))\n",
+ "fig.update_layout(title=\"Average Price by Year\", xaxis_title=\"Year\", yaxis_title=\"Average Price (£)\", height=500)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "name": "National",
+ "opacity": 0.7,
+ "type": "bar",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "y": {
+ "bdata": "AAAAAAAA+H868rea4AsVQBrBY2A8qSNAml1eGSqPIUDyR4g8N9EoQNtU9+2e1idAeHwSWGY1JUB/k3ja0wgwQEeieEJ3ASpAVsIZBXKELUCg+28ao3EXQP95xV/i4h1ABBFBfp8eH0CNsJzXlV/wv2JFoe2vefu/ds9e7SJCJUBPKLB08DD2v/QVJYsJLgNAHnbdVxsfH0Ddtis+P/shQGMrVIs/1hhA18CGKDHfFUAGRW/kQCAlQJQ+ufCxj/Y/SHPjfZji7z/CiZhwrFsZQGcq3QPplwhAnbuEADFuGUDzESgmwn4AwHhizdus2APAhsPIYTg1HMA=",
+ "dtype": "f8"
+ }
+ },
+ {
+ "name": "London",
+ "opacity": 0.7,
+ "type": "bar",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "y": {
+ "bdata": "AAAAAAAA+H/mny9M2qEfQIUvGk+EYytAsKbM5hVkKUCRAPjbHUMxQC0EApGGJzNAxZlHWdsVIUCA6qSqCLQrQLxttM8Y9R5AHzZB4TpQI0A1APUPa3oVQI2ZheigryFATyVI7ms+J0BpJVbl0bEEQHdfzDrAXcg/GqviBgYaKUAQh9xZ8BMLQH2D4t+ymQ5AkRYlWO75MEBiCoUDXd0sQOMb2XZifCNAUbwmHC/EIEBngbhPllEsQAlT7EZm1AhAU3/m64wMAEAQlX00nfn9P8v1TXtN6BjAMI/EHBawHEBkdOa0oxrLv437xvxP5RfA8asaOBjBJ8A=",
+ "dtype": "f8"
+ }
+ }
+ ],
+ "layout": {
+ "barmode": "group",
+ "height": 500,
+ "shapes": [
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 0,
+ "x1": 1,
+ "xref": "x domain",
+ "y0": 0,
+ "y1": 0,
+ "yref": "y"
+ }
+ ],
+ "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": "Year-over-Year Price Change (%)"
+ },
+ "xaxis": {
+ "title": {
+ "text": "Year"
+ }
+ },
+ "yaxis": {
+ "title": {
+ "text": "Change (%)"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "yearly_national_pct = yearly_national.with_columns((pl.col(\"avg_price\").pct_change() * 100).alias(\"yoy_change\"))\n",
+ "yearly_london_pct = yearly_london.with_columns((pl.col(\"avg_price\").pct_change() * 100).alias(\"yoy_change\"))\n",
+ "\n",
+ "fig = go.Figure()\n",
+ "fig.add_trace(go.Bar(x=yearly_national_pct[\"year\"], y=yearly_national_pct[\"yoy_change\"], name=\"National\", opacity=0.7))\n",
+ "fig.add_trace(go.Bar(x=yearly_london_pct[\"year\"], y=yearly_london_pct[\"yoy_change\"], name=\"London\", opacity=0.7))\n",
+ "fig.add_hline(y=0, line_dash=\"dash\", line_color=\"gray\")\n",
+ "fig.update_layout(title=\"Year-over-Year Price Change (%)\", xaxis_title=\"Year\", yaxis_title=\"Change (%)\", barmode=\"group\", height=500)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "mode": "lines",
+ "name": "National",
+ "type": "scatter",
+ "x": [
+ "2015-01-01T00:00:00.000000",
+ "2015-02-01T00:00:00.000000",
+ "2015-03-01T00:00:00.000000",
+ "2015-04-01T00:00:00.000000",
+ "2015-05-01T00:00:00.000000",
+ "2015-06-01T00:00:00.000000",
+ "2015-07-01T00:00:00.000000",
+ "2015-08-01T00:00:00.000000",
+ "2015-09-01T00:00:00.000000",
+ "2015-10-01T00:00:00.000000",
+ "2015-11-01T00:00:00.000000",
+ "2015-12-01T00:00:00.000000",
+ "2016-01-01T00:00:00.000000",
+ "2016-02-01T00:00:00.000000",
+ "2016-03-01T00:00:00.000000",
+ "2016-04-01T00:00:00.000000",
+ "2016-05-01T00:00:00.000000",
+ "2016-06-01T00:00:00.000000",
+ "2016-07-01T00:00:00.000000",
+ "2016-08-01T00:00:00.000000",
+ "2016-09-01T00:00:00.000000",
+ "2016-10-01T00:00:00.000000",
+ "2016-11-01T00:00:00.000000",
+ "2016-12-01T00:00:00.000000",
+ "2017-01-01T00:00:00.000000",
+ "2017-02-01T00:00:00.000000",
+ "2017-03-01T00:00:00.000000",
+ "2017-04-01T00:00:00.000000",
+ "2017-05-01T00:00:00.000000",
+ "2017-06-01T00:00:00.000000",
+ "2017-07-01T00:00:00.000000",
+ "2017-08-01T00:00:00.000000",
+ "2017-09-01T00:00:00.000000",
+ "2017-10-01T00:00:00.000000",
+ "2017-11-01T00:00:00.000000",
+ "2017-12-01T00:00:00.000000",
+ "2018-01-01T00:00:00.000000",
+ "2018-02-01T00:00:00.000000",
+ "2018-03-01T00:00:00.000000",
+ "2018-04-01T00:00:00.000000",
+ "2018-05-01T00:00:00.000000",
+ "2018-06-01T00:00:00.000000",
+ "2018-07-01T00:00:00.000000",
+ "2018-08-01T00:00:00.000000",
+ "2018-09-01T00:00:00.000000",
+ "2018-10-01T00:00:00.000000",
+ "2018-11-01T00:00:00.000000",
+ "2018-12-01T00:00:00.000000",
+ "2019-01-01T00:00:00.000000",
+ "2019-02-01T00:00:00.000000",
+ "2019-03-01T00:00:00.000000",
+ "2019-04-01T00:00:00.000000",
+ "2019-05-01T00:00:00.000000",
+ "2019-06-01T00:00:00.000000",
+ "2019-07-01T00:00:00.000000",
+ "2019-08-01T00:00:00.000000",
+ "2019-09-01T00:00:00.000000",
+ "2019-10-01T00:00:00.000000",
+ "2019-11-01T00:00:00.000000",
+ "2019-12-01T00:00:00.000000",
+ "2020-01-01T00:00:00.000000",
+ "2020-02-01T00:00:00.000000",
+ "2020-03-01T00:00:00.000000",
+ "2020-04-01T00:00:00.000000",
+ "2020-05-01T00:00:00.000000",
+ "2020-06-01T00:00:00.000000",
+ "2020-07-01T00:00:00.000000",
+ "2020-08-01T00:00:00.000000",
+ "2020-09-01T00:00:00.000000",
+ "2020-10-01T00:00:00.000000",
+ "2020-11-01T00:00:00.000000",
+ "2020-12-01T00:00:00.000000",
+ "2021-01-01T00:00:00.000000",
+ "2021-02-01T00:00:00.000000",
+ "2021-03-01T00:00:00.000000",
+ "2021-04-01T00:00:00.000000",
+ "2021-05-01T00:00:00.000000",
+ "2021-06-01T00:00:00.000000",
+ "2021-07-01T00:00:00.000000",
+ "2021-08-01T00:00:00.000000",
+ "2021-09-01T00:00:00.000000",
+ "2021-10-01T00:00:00.000000",
+ "2021-11-01T00:00:00.000000",
+ "2021-12-01T00:00:00.000000",
+ "2022-01-01T00:00:00.000000",
+ "2022-02-01T00:00:00.000000",
+ "2022-03-01T00:00:00.000000",
+ "2022-04-01T00:00:00.000000",
+ "2022-05-01T00:00:00.000000",
+ "2022-06-01T00:00:00.000000",
+ "2022-07-01T00:00:00.000000",
+ "2022-08-01T00:00:00.000000",
+ "2022-09-01T00:00:00.000000",
+ "2022-10-01T00:00:00.000000",
+ "2022-11-01T00:00:00.000000",
+ "2022-12-01T00:00:00.000000",
+ "2023-01-01T00:00:00.000000",
+ "2023-02-01T00:00:00.000000",
+ "2023-03-01T00:00:00.000000",
+ "2023-04-01T00:00:00.000000",
+ "2023-05-01T00:00:00.000000",
+ "2023-06-01T00:00:00.000000",
+ "2023-07-01T00:00:00.000000",
+ "2023-08-01T00:00:00.000000",
+ "2023-09-01T00:00:00.000000",
+ "2023-10-01T00:00:00.000000",
+ "2023-11-01T00:00:00.000000",
+ "2023-12-01T00:00:00.000000",
+ "2024-01-01T00:00:00.000000",
+ "2024-02-01T00:00:00.000000",
+ "2024-03-01T00:00:00.000000",
+ "2024-04-01T00:00:00.000000",
+ "2024-05-01T00:00:00.000000",
+ "2024-06-01T00:00:00.000000",
+ "2024-07-01T00:00:00.000000",
+ "2024-08-01T00:00:00.000000",
+ "2024-09-01T00:00:00.000000",
+ "2024-10-01T00:00:00.000000",
+ "2024-11-01T00:00:00.000000",
+ "2024-12-01T00:00:00.000000",
+ "2025-01-01T00:00:00.000000",
+ "2025-02-01T00:00:00.000000",
+ "2025-03-01T00:00:00.000000",
+ "2025-04-01T00:00:00.000000",
+ "2025-05-01T00:00:00.000000",
+ "2025-06-01T00:00:00.000000",
+ "2025-07-01T00:00:00.000000",
+ "2025-08-01T00:00:00.000000",
+ "2025-09-01T00:00:00.000000",
+ "2025-10-01T00:00:00.000000",
+ "2025-11-01T00:00:00.000000"
+ ],
+ "y": {
+ "bdata": "3a80/gXUEUFC96pajBERQXlmL7xM6BFBot5trU+vEUG52oDGyu4QQYGzBDITMhJBHh4ejmAQE0FJTQV7a1MSQaiZycy1lhJBhVKW/xvKEUEPt9GXl0ISQeu321/xYBNBQtRHXO6EEkEA9jBotbARQc6qO1xwRhJBSyLMimLpEUGJFPvOmyQSQWxFeVqN2BJB8Q4BUBqUEkHuOAsXHVwSQaJ2ddvh9RNBMopQk5l5FEGnwy4xYgQVQaOycNfsYBVBhgVhsweZFEEpvH6ECZ4UQcVjicoFXhVBMn5qaldGFUGCSIANRYwUQaHMhQcb5RRBRieE2L0TFkFbTO/9y58UQQpovG3rZBVBkJQNWIcoFkGpM8/IaI4UQXlFLDv3tBVBQUpf+5PlFUFVTKO5Fs8VQcnTIzwuPBVBthjZHF8ZFUHHgw6qv9cUQQNfGQlbBBVBLuHJ9HrFFUE+83++dFUVQe1KVMp7yhZBYivrRYWDFEF/q3HyrpIVQbauFUqw8xVBtAW/Ui9qFUEJmFjNK70UQafYMlqAuRhBgxJccrOZFUEHZKmwQPgTQQ3snHqRChVBZlMjfqeLFkGD+ZzFH78VQRqekE07phVBhkXLFtKAFEExcYRu9eUUQRqsTB92OhdBG0tkC3E0FUFoqRk3m+8UQQtQIR+JkBdBTFE/NK0WHEEZI3twytwTQabBzaUv3hVBesCQIQjlFkHAEa9V1lUVQchI+QFqgBpB9Qq4EE7yFkHwrNToi/AWQaSlgwr7XRhBbI2WOVJ2F0EWO5mVZnwWQQVuJXJm/RlBl2oZsewgFkFnJzngCU4WQfrwU0NNhRpB1xg9P5/fE0EQeotCxI4VQd7PAT0mgRdBAQ8rVmNGF0E7V/J4/UEXQdudfufNbhlBC4n5yQ9AGUH2lSR8rZ8XQUVCZe9IgRhBip6Tvz3xGEEeP5iwebEYQS6G1MPohhlBRvHjwOxVGUHmokf7K+YaQcZDUCKywxpBL5mLRM6YGEHWqLj341MZQRWKa8aEdhlBTBhV/2U9GEGKQ6rJJL0XQSqlQEqxWhlB5QklATKbGEHSUsC8MckYQXrAWCONPRpBRlGe4cTTGEHi5Pcxnk4ZQbyTXGRhlhhBGOUKgb0WGEEBatiC8KUXQaSrRL2TPxlBSC3wz5UJGEEmDSbNlY8XQfBRapFhFhlBFuAUXka9GEHewSs5RfsXQdG05s/rJBdBjq1zjvE+GEHTUhWupzsYQR+1LMZ6nxhBw6V4+iYAGUGQ5N+uUiEXQZidlhodzxdBOKBNJXv7F0FTVYA1XRoXQWI+wuafjhdBE15k2vF+FUG1p7U49jUWQaLLi+t0LhZBMSafM3TVFUFa4gU6jJQVQc/7sFv37RVBJCC4A8ndFEEHMK/NbqAUQQ==",
+ "dtype": "f8"
+ }
+ },
+ {
+ "line": {
+ "color": "crimson"
+ },
+ "mode": "lines",
+ "name": "London",
+ "type": "scatter",
+ "x": [
+ "2015-01-01T00:00:00.000000",
+ "2015-02-01T00:00:00.000000",
+ "2015-03-01T00:00:00.000000",
+ "2015-04-01T00:00:00.000000",
+ "2015-05-01T00:00:00.000000",
+ "2015-06-01T00:00:00.000000",
+ "2015-07-01T00:00:00.000000",
+ "2015-08-01T00:00:00.000000",
+ "2015-09-01T00:00:00.000000",
+ "2015-10-01T00:00:00.000000",
+ "2015-11-01T00:00:00.000000",
+ "2015-12-01T00:00:00.000000",
+ "2016-01-01T00:00:00.000000",
+ "2016-02-01T00:00:00.000000",
+ "2016-03-01T00:00:00.000000",
+ "2016-04-01T00:00:00.000000",
+ "2016-05-01T00:00:00.000000",
+ "2016-06-01T00:00:00.000000",
+ "2016-07-01T00:00:00.000000",
+ "2016-08-01T00:00:00.000000",
+ "2016-09-01T00:00:00.000000",
+ "2016-10-01T00:00:00.000000",
+ "2016-11-01T00:00:00.000000",
+ "2016-12-01T00:00:00.000000",
+ "2017-01-01T00:00:00.000000",
+ "2017-02-01T00:00:00.000000",
+ "2017-03-01T00:00:00.000000",
+ "2017-04-01T00:00:00.000000",
+ "2017-05-01T00:00:00.000000",
+ "2017-06-01T00:00:00.000000",
+ "2017-07-01T00:00:00.000000",
+ "2017-08-01T00:00:00.000000",
+ "2017-09-01T00:00:00.000000",
+ "2017-10-01T00:00:00.000000",
+ "2017-11-01T00:00:00.000000",
+ "2017-12-01T00:00:00.000000",
+ "2018-01-01T00:00:00.000000",
+ "2018-02-01T00:00:00.000000",
+ "2018-03-01T00:00:00.000000",
+ "2018-04-01T00:00:00.000000",
+ "2018-05-01T00:00:00.000000",
+ "2018-06-01T00:00:00.000000",
+ "2018-07-01T00:00:00.000000",
+ "2018-08-01T00:00:00.000000",
+ "2018-09-01T00:00:00.000000",
+ "2018-10-01T00:00:00.000000",
+ "2018-11-01T00:00:00.000000",
+ "2018-12-01T00:00:00.000000",
+ "2019-01-01T00:00:00.000000",
+ "2019-02-01T00:00:00.000000",
+ "2019-03-01T00:00:00.000000",
+ "2019-04-01T00:00:00.000000",
+ "2019-05-01T00:00:00.000000",
+ "2019-06-01T00:00:00.000000",
+ "2019-07-01T00:00:00.000000",
+ "2019-08-01T00:00:00.000000",
+ "2019-09-01T00:00:00.000000",
+ "2019-10-01T00:00:00.000000",
+ "2019-11-01T00:00:00.000000",
+ "2019-12-01T00:00:00.000000",
+ "2020-01-01T00:00:00.000000",
+ "2020-02-01T00:00:00.000000",
+ "2020-03-01T00:00:00.000000",
+ "2020-04-01T00:00:00.000000",
+ "2020-05-01T00:00:00.000000",
+ "2020-06-01T00:00:00.000000",
+ "2020-07-01T00:00:00.000000",
+ "2020-08-01T00:00:00.000000",
+ "2020-09-01T00:00:00.000000",
+ "2020-10-01T00:00:00.000000",
+ "2020-11-01T00:00:00.000000",
+ "2020-12-01T00:00:00.000000",
+ "2021-01-01T00:00:00.000000",
+ "2021-02-01T00:00:00.000000",
+ "2021-03-01T00:00:00.000000",
+ "2021-04-01T00:00:00.000000",
+ "2021-05-01T00:00:00.000000",
+ "2021-06-01T00:00:00.000000",
+ "2021-07-01T00:00:00.000000",
+ "2021-08-01T00:00:00.000000",
+ "2021-09-01T00:00:00.000000",
+ "2021-10-01T00:00:00.000000",
+ "2021-11-01T00:00:00.000000",
+ "2021-12-01T00:00:00.000000",
+ "2022-01-01T00:00:00.000000",
+ "2022-02-01T00:00:00.000000",
+ "2022-03-01T00:00:00.000000",
+ "2022-04-01T00:00:00.000000",
+ "2022-05-01T00:00:00.000000",
+ "2022-06-01T00:00:00.000000",
+ "2022-07-01T00:00:00.000000",
+ "2022-08-01T00:00:00.000000",
+ "2022-09-01T00:00:00.000000",
+ "2022-10-01T00:00:00.000000",
+ "2022-11-01T00:00:00.000000",
+ "2022-12-01T00:00:00.000000",
+ "2023-01-01T00:00:00.000000",
+ "2023-02-01T00:00:00.000000",
+ "2023-03-01T00:00:00.000000",
+ "2023-04-01T00:00:00.000000",
+ "2023-05-01T00:00:00.000000",
+ "2023-06-01T00:00:00.000000",
+ "2023-07-01T00:00:00.000000",
+ "2023-08-01T00:00:00.000000",
+ "2023-09-01T00:00:00.000000",
+ "2023-10-01T00:00:00.000000",
+ "2023-11-01T00:00:00.000000",
+ "2023-12-01T00:00:00.000000",
+ "2024-01-01T00:00:00.000000",
+ "2024-02-01T00:00:00.000000",
+ "2024-03-01T00:00:00.000000",
+ "2024-04-01T00:00:00.000000",
+ "2024-05-01T00:00:00.000000",
+ "2024-06-01T00:00:00.000000",
+ "2024-07-01T00:00:00.000000",
+ "2024-08-01T00:00:00.000000",
+ "2024-09-01T00:00:00.000000",
+ "2024-10-01T00:00:00.000000",
+ "2024-11-01T00:00:00.000000",
+ "2024-12-01T00:00:00.000000",
+ "2025-01-01T00:00:00.000000",
+ "2025-02-01T00:00:00.000000",
+ "2025-03-01T00:00:00.000000",
+ "2025-04-01T00:00:00.000000",
+ "2025-05-01T00:00:00.000000",
+ "2025-06-01T00:00:00.000000",
+ "2025-07-01T00:00:00.000000",
+ "2025-08-01T00:00:00.000000",
+ "2025-09-01T00:00:00.000000",
+ "2025-10-01T00:00:00.000000",
+ "2025-11-01T00:00:00.000000"
+ ],
+ "y": {
+ "bdata": "luAEDAesIUFwKWbhMv4hQVS3+mrhviNBOm/lSj1bI0HztD1iNTEiQQ9/SuQMniNB/gxCkmJJJUFaP+aQqWsjQU8XurZ7kSNBwuiJZkOFIkFfsX0FT5okQVN857GBfiZBDDEVqGYPJEHKDEm7DdAiQTiAuR8j8SNB3z/5oOY/I0GOB9S2yKMkQQdXlVyltCRB54woDbt6I0FGPItjH7oiQb6iTmMg5SVBIa+XtrjdJ0HwEFvsfIMpQYa/QJr15SpBbAyo8OFrJkGx1Crl8GsnQfmZKWnIgCdBxWUgZoTdKUHW+Bz4y3koQf1j5NBTiylBoEOSirYFK0E6iqBfI6slQTyaP4BX9ChBnVQa3bmkJ0Fg5o7h82onQWH/idQ0nClBo/nXIdCzKkGMxLHwNmQqQabO/KOMSihBUvfASiltKUGXl0YfTakpQfNj4mIuZilB/rWukD8WKkFaocPzPi0nQZAFPhZYmypBQ9Md7K9NJkEtBzrKqUsnQRI05qjfbCpB6oN4qzORKkEwaMBTQlImQdHiaWMxmjJBxSGNYfBPK0ELNtfsZR0nQesOkbPekyhB/gDtioXqJ0G4CZHFmFkoQYzSOpzmSChBZwNslZ41JUE7yG97pxQoQfzrpsk2bSxBDHhu+P6sKEGMBzMQ9S8nQbggJFlXoClB0SC4Y1rTLUGFOYPTtfsmQYEby8BVkStBaKaBgIMUKEG1DT/VdfgmQSeyTukaOjJB/EB9tZenKUFWjXgM8d8nQaqPRNRUQClBOk9Xeqc0J0GbDliL7EclQXrAAp3/HypBwQJiMmgRJEHWMTl/LeAnQfIwJGB8HSZBdk3kzdlBLUHIVVHfYDkpQbTPaPZGOClB1YO3wUzVLUHlHMsrVuwqQbU0idFjuixBB0zltNYuLUGLRPXmsOUnQeXjF9IK2SlBc2pMY9nELEEHXLEGUhwqQbNE1mcdJitBpBPqX9aGKkGgf913S+UrQX7ei/S3ZCpBQKtBy1iXJ0FA70swAywoQbI4pTIpYilB3+AugBhqKUEws3x4GgEnQdMZUuevISxBh7+XX9bxKUGdCYNYtg4qQYFDIESLgC9B4RIg+3TjJ0E6ZwJaCfspQXKkr6bISypBI4PMtTPkKEHAqk65lcEoQWIcnNpD5ypBi3jwZBlGKkEww5KOprwnQSNzd4/CSSpBlHq0Hc/VKkHkpED8NAsoQY4zNawp3ydBP4HhbEz3J0HYFIgc1iwoQY0bnaOT2yhBxp41HXj9J0Ei/b0sHRknQaqkgIQtmShBPKPlYbsOKEFLHFKtcIcmQcxygP+osCNBfdRGwtJXKUHfLKU+Nj0oQcPGAQdb1CVBbDIGbLFpJEGbTInMorMjQRURPbs9rihBsgN7zuPfI0GQbQgomI4hQQ==",
+ "dtype": "f8"
+ }
+ }
+ ],
+ "layout": {
+ "height": 500,
+ "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": "Monthly Average Price (2015 onwards)"
+ },
+ "xaxis": {
+ "title": {
+ "text": "Month"
+ }
+ },
+ "yaxis": {
+ "title": {
+ "text": "Average Price (£)"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "def get_monthly_stats(lazy_frame, start_year=2015):\n",
+ " return (\n",
+ " lazy_frame.filter(pl.col(\"date_of_transfer\").dt.year() >= start_year)\n",
+ " .with_columns(pl.col(\"date_of_transfer\").dt.truncate(\"1mo\").alias(\"month\"))\n",
+ " .group_by(\"month\")\n",
+ " .agg(pl.len().alias(\"count\"), pl.col(\"price\").mean().alias(\"avg_price\"), pl.col(\"price\").median().alias(\"median_price\"))\n",
+ " .sort(\"month\")\n",
+ " .collect()\n",
+ " )\n",
+ "\n",
+ "monthly_national = get_monthly_stats(lf)\n",
+ "monthly_london = get_monthly_stats(lf.filter(LONDON_FILTER))\n",
+ "\n",
+ "fig = go.Figure()\n",
+ "fig.add_trace(go.Scatter(x=monthly_national[\"month\"], y=monthly_national[\"avg_price\"], name=\"National\", mode=\"lines\"))\n",
+ "fig.add_trace(go.Scatter(x=monthly_london[\"month\"], y=monthly_london[\"avg_price\"], name=\"London\", mode=\"lines\", line=dict(color=\"crimson\")))\n",
+ "fig.update_layout(title=\"Monthly Average Price (2015 onwards)\", xaxis_title=\"Month\", yaxis_title=\"Average Price (£)\", height=500)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "Property Type=Detached
Year=%{x}
Average Price (£)=%{y}",
+ "legendgroup": "Detached",
+ "line": {
+ "color": "#636efa",
+ "dash": "solid"
+ },
+ "marker": {
+ "symbol": "circle"
+ },
+ "mode": "lines+markers",
+ "name": "Detached",
+ "orientation": "v",
+ "showlegend": true,
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "xaxis": "x",
+ "y": {
+ "bdata": "he7aSLi/CEFoN1HZAJAKQUY4cXYqNA5BmCYOQ6h8EkElIzG0u48UQeBpcT5PfxhBonCi/DDEGUGMRRiD7RUcQcQ/kuu+EB9BJEZk1BEQIUGZxLYWBcshQb27SvI8YyNB5+vvv8SyJUHh5E4zurMnQYAXJGVJ1yRBXOxwvdgiKEFRsmsTwYMnQUyGYB0SMydBNIUCsvpAKUHS8WO8cv8rQepZmB6R/yxBCNnlsjI8L0E1vqw6OicwQVbzCW9KyzBBA2/mqxRzMEEny9kScZkxQTPTgYu31jJB362yvuYNNUGL5FNq7ig1QVr2KFX/FDRBOL3pTarhMkE=",
+ "dtype": "f8"
+ },
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Property Type=Terraced
Year=%{x}
Average Price (£)=%{y}",
+ "legendgroup": "Terraced",
+ "line": {
+ "color": "#EF553B",
+ "dash": "solid"
+ },
+ "marker": {
+ "symbol": "circle"
+ },
+ "mode": "lines+markers",
+ "name": "Terraced",
+ "orientation": "v",
+ "showlegend": true,
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "xaxis": "x",
+ "y": {
+ "bdata": "cph/WyoB+EDmW75F0275QAjetIpYnf1AF+zrVa+ZAEFE1CEGEbUDQe5Jd9N0AAhBrs1quM5OCUE0CeRsExQNQcNllA9QfA9B6KlaheJpEUEce6AslI4SQRM0w213XBRB1WxKwtkDF0EdGHF0S14XQefbnEvtqhdBq+jYexh4G0EOo1mWC0QcQToiNyy85x1BDZav3HRpIEEzefthii0iQTSHLIP+eyJBk4HmHejMI0GFBBzUEj8kQRZNkIJ6ciRBIleyz6VGJEFAAsiGV80lQW2snlz6dSZBT2ES0DK2KUE6oC7G64MoQZhoE/39ZChB+R6N+15RJkE=",
+ "dtype": "f8"
+ },
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Property Type=Other
Year=%{x}
Average Price (£)=%{y}",
+ "legendgroup": "Other",
+ "line": {
+ "color": "#00cc96",
+ "dash": "solid"
+ },
+ "marker": {
+ "symbol": "circle"
+ },
+ "mode": "lines+markers",
+ "name": "Other",
+ "orientation": "v",
+ "showlegend": true,
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAANAHAADRBwAA0gcAANQHAADVBwAA1gcAANcHAADYBwAA2QcAANoHAADbBwAA3AcAAN0HAADeBwAA3wcAAOAHAADhBwAA4gcAAOMHAADkBwAA5QcAAOYHAADnBwAA6AcAAOkHAAA=",
+ "dtype": "i4"
+ },
+ "xaxis": "x",
+ "y": {
+ "bdata": "AAAAAABwt0AAAAAAAOHpQKuqqqqKWPlAAAAAAIBV4UAAAAAA+OsGQQAAAABATxFBAAAAAMBi1ECrqqqqqofKQAAAAAAA+cVAL7rooms7AkEbymsoP3UCQb2G8hqKCdtAVVVVVXWi2UDT0tLSYu4HQR+F61FB1UdB4uHhYbewO0H91mlAk9FWQQyr2KccXE5BM60RmtNkUEHpBS9iCk9GQa0PyglLdkZBotrVTw1MSUF5jpBrRyNKQVGDG4mciUpBqUAMKV7DSUEYXw2P189IQV7iLQtVIUZBMVxIAFNpQ0GUbp7dHVhHQQ==",
+ "dtype": "f8"
+ },
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Property Type=Flat/Maisonette
Year=%{x}
Average Price (£)=%{y}",
+ "legendgroup": "Flat/Maisonette",
+ "line": {
+ "color": "#ab63fa",
+ "dash": "solid"
+ },
+ "marker": {
+ "symbol": "circle"
+ },
+ "mode": "lines+markers",
+ "name": "Flat/Maisonette",
+ "orientation": "v",
+ "showlegend": true,
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "xaxis": "x",
+ "y": {
+ "bdata": "Zn0HnGWK80CI6Sk7oaX1QEFxn18Au/hAwCOAZu0S/EDBWeiVbXgAQeTLL9eqzgNBryNeoX+6BUFXaO9zRMAIQetQ7cQvbgpBgmN/9GIPDUGtQpq8DlsOQSSo31g+WBBBQgfyCi48EkEMHgaL1d4SQRKgdf+L6RJBLldJJ+DCFEG2ZwTWCq0VQdBRbpxxzxZBE6A2bZv2GEH9TXXvp/IbQfUGUKpbZx1BlCmtRkzAH0HJWN/QRtwgQfR/6pWJyyBBNdqOI+jBIEHVnj0D6L8hQSRl2W1ZmyBBI+qzJdztIUHphTM6deEiQbHkCOA5myFBAEfvwjinH0E=",
+ "dtype": "f8"
+ },
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Property Type=Semi-detached
Year=%{x}
Average Price (£)=%{y}",
+ "legendgroup": "Semi-detached",
+ "line": {
+ "color": "#FFA15A",
+ "dash": "solid"
+ },
+ "marker": {
+ "symbol": "circle"
+ },
+ "mode": "lines+markers",
+ "name": "Semi-detached",
+ "orientation": "v",
+ "showlegend": true,
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "xaxis": "x",
+ "y": {
+ "bdata": "/hlp6rqA+kBlfGGuPsr7QA3U2BzOPgBBFEkc5hF5AkEOH7hbPVkFQdQ3zroWSglBRetdezepC0HMh86Iur0PQSIquL97URFBK/ijBo0AE0FRJPfJ+SsUQfxVLXPAuRVB2S3vDChDGEGx1QCPrekYQTqhOT1RhRdBTia8aVJ2GkHuXCtHJx8bQQshg4NcLhxBNqxBkbkiHkGNK6rjU9ggQfYdpg056SFBYO87hnc/I0Hwpamcz/QjQaHX3l6M0yNBQSK1/+HPI0Heua3ksNAkQQ/lJFlsMyZBXFAo+AdbKEEly3AWY9koQReAqH3otidBgRctZr/SJkE=",
+ "dtype": "f8"
+ },
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "height": 500,
+ "legend": {
+ "title": {
+ "text": "Property Type"
+ },
+ "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": "London: Average Price by Property Type Over Time"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Year"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Average Price (£)"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "yearly_by_type_london = (\n",
+ " lf.filter(LONDON_FILTER)\n",
+ " .with_columns(pl.col(\"date_of_transfer\").dt.year().alias(\"year\"))\n",
+ " .group_by(\"year\", \"property_type\")\n",
+ " .agg(pl.col(\"price\").mean().alias(\"avg_price\"), pl.len().alias(\"count\"))\n",
+ " .with_columns(pl.col(\"property_type\").replace(PROPERTY_TYPE_MAP).alias(\"type_name\"))\n",
+ " .sort(\"year\")\n",
+ " .collect()\n",
+ ")\n",
+ "\n",
+ "fig = px.line(yearly_by_type_london.to_pandas(), x=\"year\", y=\"avg_price\", color=\"type_name\",\n",
+ " title=\"London: Average Price by Property Type Over Time\",\n",
+ " labels={\"avg_price\": \"Average Price (£)\", \"year\": \"Year\", \"type_name\": \"Property Type\"}, markers=True)\n",
+ "fig.update_layout(height=500)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "mode": "lines",
+ "name": "Monthly",
+ "opacity": 0.5,
+ "type": "scatter",
+ "x": [
+ "2015-01-01T00:00:00.000000",
+ "2015-02-01T00:00:00.000000",
+ "2015-03-01T00:00:00.000000",
+ "2015-04-01T00:00:00.000000",
+ "2015-05-01T00:00:00.000000",
+ "2015-06-01T00:00:00.000000",
+ "2015-07-01T00:00:00.000000",
+ "2015-08-01T00:00:00.000000",
+ "2015-09-01T00:00:00.000000",
+ "2015-10-01T00:00:00.000000",
+ "2015-11-01T00:00:00.000000",
+ "2015-12-01T00:00:00.000000",
+ "2016-01-01T00:00:00.000000",
+ "2016-02-01T00:00:00.000000",
+ "2016-03-01T00:00:00.000000",
+ "2016-04-01T00:00:00.000000",
+ "2016-05-01T00:00:00.000000",
+ "2016-06-01T00:00:00.000000",
+ "2016-07-01T00:00:00.000000",
+ "2016-08-01T00:00:00.000000",
+ "2016-09-01T00:00:00.000000",
+ "2016-10-01T00:00:00.000000",
+ "2016-11-01T00:00:00.000000",
+ "2016-12-01T00:00:00.000000",
+ "2017-01-01T00:00:00.000000",
+ "2017-02-01T00:00:00.000000",
+ "2017-03-01T00:00:00.000000",
+ "2017-04-01T00:00:00.000000",
+ "2017-05-01T00:00:00.000000",
+ "2017-06-01T00:00:00.000000",
+ "2017-07-01T00:00:00.000000",
+ "2017-08-01T00:00:00.000000",
+ "2017-09-01T00:00:00.000000",
+ "2017-10-01T00:00:00.000000",
+ "2017-11-01T00:00:00.000000",
+ "2017-12-01T00:00:00.000000",
+ "2018-01-01T00:00:00.000000",
+ "2018-02-01T00:00:00.000000",
+ "2018-03-01T00:00:00.000000",
+ "2018-04-01T00:00:00.000000",
+ "2018-05-01T00:00:00.000000",
+ "2018-06-01T00:00:00.000000",
+ "2018-07-01T00:00:00.000000",
+ "2018-08-01T00:00:00.000000",
+ "2018-09-01T00:00:00.000000",
+ "2018-10-01T00:00:00.000000",
+ "2018-11-01T00:00:00.000000",
+ "2018-12-01T00:00:00.000000",
+ "2019-01-01T00:00:00.000000",
+ "2019-02-01T00:00:00.000000",
+ "2019-03-01T00:00:00.000000",
+ "2019-04-01T00:00:00.000000",
+ "2019-05-01T00:00:00.000000",
+ "2019-06-01T00:00:00.000000",
+ "2019-07-01T00:00:00.000000",
+ "2019-08-01T00:00:00.000000",
+ "2019-09-01T00:00:00.000000",
+ "2019-10-01T00:00:00.000000",
+ "2019-11-01T00:00:00.000000",
+ "2019-12-01T00:00:00.000000",
+ "2020-01-01T00:00:00.000000",
+ "2020-02-01T00:00:00.000000",
+ "2020-03-01T00:00:00.000000",
+ "2020-04-01T00:00:00.000000",
+ "2020-05-01T00:00:00.000000",
+ "2020-06-01T00:00:00.000000",
+ "2020-07-01T00:00:00.000000",
+ "2020-08-01T00:00:00.000000",
+ "2020-09-01T00:00:00.000000",
+ "2020-10-01T00:00:00.000000",
+ "2020-11-01T00:00:00.000000",
+ "2020-12-01T00:00:00.000000",
+ "2021-01-01T00:00:00.000000",
+ "2021-02-01T00:00:00.000000",
+ "2021-03-01T00:00:00.000000",
+ "2021-04-01T00:00:00.000000",
+ "2021-05-01T00:00:00.000000",
+ "2021-06-01T00:00:00.000000",
+ "2021-07-01T00:00:00.000000",
+ "2021-08-01T00:00:00.000000",
+ "2021-09-01T00:00:00.000000",
+ "2021-10-01T00:00:00.000000",
+ "2021-11-01T00:00:00.000000",
+ "2021-12-01T00:00:00.000000",
+ "2022-01-01T00:00:00.000000",
+ "2022-02-01T00:00:00.000000",
+ "2022-03-01T00:00:00.000000",
+ "2022-04-01T00:00:00.000000",
+ "2022-05-01T00:00:00.000000",
+ "2022-06-01T00:00:00.000000",
+ "2022-07-01T00:00:00.000000",
+ "2022-08-01T00:00:00.000000",
+ "2022-09-01T00:00:00.000000",
+ "2022-10-01T00:00:00.000000",
+ "2022-11-01T00:00:00.000000",
+ "2022-12-01T00:00:00.000000",
+ "2023-01-01T00:00:00.000000",
+ "2023-02-01T00:00:00.000000",
+ "2023-03-01T00:00:00.000000",
+ "2023-04-01T00:00:00.000000",
+ "2023-05-01T00:00:00.000000",
+ "2023-06-01T00:00:00.000000",
+ "2023-07-01T00:00:00.000000",
+ "2023-08-01T00:00:00.000000",
+ "2023-09-01T00:00:00.000000",
+ "2023-10-01T00:00:00.000000",
+ "2023-11-01T00:00:00.000000",
+ "2023-12-01T00:00:00.000000",
+ "2024-01-01T00:00:00.000000",
+ "2024-02-01T00:00:00.000000",
+ "2024-03-01T00:00:00.000000",
+ "2024-04-01T00:00:00.000000",
+ "2024-05-01T00:00:00.000000",
+ "2024-06-01T00:00:00.000000",
+ "2024-07-01T00:00:00.000000",
+ "2024-08-01T00:00:00.000000",
+ "2024-09-01T00:00:00.000000",
+ "2024-10-01T00:00:00.000000",
+ "2024-11-01T00:00:00.000000",
+ "2024-12-01T00:00:00.000000",
+ "2025-01-01T00:00:00.000000",
+ "2025-02-01T00:00:00.000000",
+ "2025-03-01T00:00:00.000000",
+ "2025-04-01T00:00:00.000000",
+ "2025-05-01T00:00:00.000000",
+ "2025-06-01T00:00:00.000000",
+ "2025-07-01T00:00:00.000000",
+ "2025-08-01T00:00:00.000000",
+ "2025-09-01T00:00:00.000000",
+ "2025-10-01T00:00:00.000000",
+ "2025-11-01T00:00:00.000000"
+ ],
+ "y": {
+ "bdata": "luAEDAesIUFwKWbhMv4hQVS3+mrhviNBOm/lSj1bI0HztD1iNTEiQQ9/SuQMniNB/gxCkmJJJUFaP+aQqWsjQU8XurZ7kSNBwuiJZkOFIkFfsX0FT5okQVN857GBfiZBDDEVqGYPJEHKDEm7DdAiQTiAuR8j8SNB3z/5oOY/I0GOB9S2yKMkQQdXlVyltCRB54woDbt6I0FGPItjH7oiQb6iTmMg5SVBIa+XtrjdJ0HwEFvsfIMpQYa/QJr15SpBbAyo8OFrJkGx1Crl8GsnQfmZKWnIgCdBxWUgZoTdKUHW+Bz4y3koQf1j5NBTiylBoEOSirYFK0E6iqBfI6slQTyaP4BX9ChBnVQa3bmkJ0Fg5o7h82onQWH/idQ0nClBo/nXIdCzKkGMxLHwNmQqQabO/KOMSihBUvfASiltKUGXl0YfTakpQfNj4mIuZilB/rWukD8WKkFaocPzPi0nQZAFPhZYmypBQ9Md7K9NJkEtBzrKqUsnQRI05qjfbCpB6oN4qzORKkEwaMBTQlImQdHiaWMxmjJBxSGNYfBPK0ELNtfsZR0nQesOkbPekyhB/gDtioXqJ0G4CZHFmFkoQYzSOpzmSChBZwNslZ41JUE7yG97pxQoQfzrpsk2bSxBDHhu+P6sKEGMBzMQ9S8nQbggJFlXoClB0SC4Y1rTLUGFOYPTtfsmQYEby8BVkStBaKaBgIMUKEG1DT/VdfgmQSeyTukaOjJB/EB9tZenKUFWjXgM8d8nQaqPRNRUQClBOk9Xeqc0J0GbDliL7EclQXrAAp3/HypBwQJiMmgRJEHWMTl/LeAnQfIwJGB8HSZBdk3kzdlBLUHIVVHfYDkpQbTPaPZGOClB1YO3wUzVLUHlHMsrVuwqQbU0idFjuixBB0zltNYuLUGLRPXmsOUnQeXjF9IK2SlBc2pMY9nELEEHXLEGUhwqQbNE1mcdJitBpBPqX9aGKkGgf913S+UrQX7ei/S3ZCpBQKtBy1iXJ0FA70swAywoQbI4pTIpYilB3+AugBhqKUEws3x4GgEnQdMZUuevISxBh7+XX9bxKUGdCYNYtg4qQYFDIESLgC9B4RIg+3TjJ0E6ZwJaCfspQXKkr6bISypBI4PMtTPkKEHAqk65lcEoQWIcnNpD5ypBi3jwZBlGKkEww5KOprwnQSNzd4/CSSpBlHq0Hc/VKkHkpED8NAsoQY4zNawp3ydBP4HhbEz3J0HYFIgc1iwoQY0bnaOT2yhBxp41HXj9J0Ei/b0sHRknQaqkgIQtmShBPKPlYbsOKEFLHFKtcIcmQcxygP+osCNBfdRGwtJXKUHfLKU+Nj0oQcPGAQdb1CVBbDIGbLFpJEGbTInMorMjQRURPbs9rihBsgN7zuPfI0GQbQgomI4hQQ==",
+ "dtype": "f8"
+ }
+ },
+ {
+ "line": {
+ "color": "crimson",
+ "width": 3
+ },
+ "mode": "lines",
+ "name": "12-Month Rolling Avg",
+ "type": "scatter",
+ "x": [
+ "2015-01-01T00:00:00.000000",
+ "2015-02-01T00:00:00.000000",
+ "2015-03-01T00:00:00.000000",
+ "2015-04-01T00:00:00.000000",
+ "2015-05-01T00:00:00.000000",
+ "2015-06-01T00:00:00.000000",
+ "2015-07-01T00:00:00.000000",
+ "2015-08-01T00:00:00.000000",
+ "2015-09-01T00:00:00.000000",
+ "2015-10-01T00:00:00.000000",
+ "2015-11-01T00:00:00.000000",
+ "2015-12-01T00:00:00.000000",
+ "2016-01-01T00:00:00.000000",
+ "2016-02-01T00:00:00.000000",
+ "2016-03-01T00:00:00.000000",
+ "2016-04-01T00:00:00.000000",
+ "2016-05-01T00:00:00.000000",
+ "2016-06-01T00:00:00.000000",
+ "2016-07-01T00:00:00.000000",
+ "2016-08-01T00:00:00.000000",
+ "2016-09-01T00:00:00.000000",
+ "2016-10-01T00:00:00.000000",
+ "2016-11-01T00:00:00.000000",
+ "2016-12-01T00:00:00.000000",
+ "2017-01-01T00:00:00.000000",
+ "2017-02-01T00:00:00.000000",
+ "2017-03-01T00:00:00.000000",
+ "2017-04-01T00:00:00.000000",
+ "2017-05-01T00:00:00.000000",
+ "2017-06-01T00:00:00.000000",
+ "2017-07-01T00:00:00.000000",
+ "2017-08-01T00:00:00.000000",
+ "2017-09-01T00:00:00.000000",
+ "2017-10-01T00:00:00.000000",
+ "2017-11-01T00:00:00.000000",
+ "2017-12-01T00:00:00.000000",
+ "2018-01-01T00:00:00.000000",
+ "2018-02-01T00:00:00.000000",
+ "2018-03-01T00:00:00.000000",
+ "2018-04-01T00:00:00.000000",
+ "2018-05-01T00:00:00.000000",
+ "2018-06-01T00:00:00.000000",
+ "2018-07-01T00:00:00.000000",
+ "2018-08-01T00:00:00.000000",
+ "2018-09-01T00:00:00.000000",
+ "2018-10-01T00:00:00.000000",
+ "2018-11-01T00:00:00.000000",
+ "2018-12-01T00:00:00.000000",
+ "2019-01-01T00:00:00.000000",
+ "2019-02-01T00:00:00.000000",
+ "2019-03-01T00:00:00.000000",
+ "2019-04-01T00:00:00.000000",
+ "2019-05-01T00:00:00.000000",
+ "2019-06-01T00:00:00.000000",
+ "2019-07-01T00:00:00.000000",
+ "2019-08-01T00:00:00.000000",
+ "2019-09-01T00:00:00.000000",
+ "2019-10-01T00:00:00.000000",
+ "2019-11-01T00:00:00.000000",
+ "2019-12-01T00:00:00.000000",
+ "2020-01-01T00:00:00.000000",
+ "2020-02-01T00:00:00.000000",
+ "2020-03-01T00:00:00.000000",
+ "2020-04-01T00:00:00.000000",
+ "2020-05-01T00:00:00.000000",
+ "2020-06-01T00:00:00.000000",
+ "2020-07-01T00:00:00.000000",
+ "2020-08-01T00:00:00.000000",
+ "2020-09-01T00:00:00.000000",
+ "2020-10-01T00:00:00.000000",
+ "2020-11-01T00:00:00.000000",
+ "2020-12-01T00:00:00.000000",
+ "2021-01-01T00:00:00.000000",
+ "2021-02-01T00:00:00.000000",
+ "2021-03-01T00:00:00.000000",
+ "2021-04-01T00:00:00.000000",
+ "2021-05-01T00:00:00.000000",
+ "2021-06-01T00:00:00.000000",
+ "2021-07-01T00:00:00.000000",
+ "2021-08-01T00:00:00.000000",
+ "2021-09-01T00:00:00.000000",
+ "2021-10-01T00:00:00.000000",
+ "2021-11-01T00:00:00.000000",
+ "2021-12-01T00:00:00.000000",
+ "2022-01-01T00:00:00.000000",
+ "2022-02-01T00:00:00.000000",
+ "2022-03-01T00:00:00.000000",
+ "2022-04-01T00:00:00.000000",
+ "2022-05-01T00:00:00.000000",
+ "2022-06-01T00:00:00.000000",
+ "2022-07-01T00:00:00.000000",
+ "2022-08-01T00:00:00.000000",
+ "2022-09-01T00:00:00.000000",
+ "2022-10-01T00:00:00.000000",
+ "2022-11-01T00:00:00.000000",
+ "2022-12-01T00:00:00.000000",
+ "2023-01-01T00:00:00.000000",
+ "2023-02-01T00:00:00.000000",
+ "2023-03-01T00:00:00.000000",
+ "2023-04-01T00:00:00.000000",
+ "2023-05-01T00:00:00.000000",
+ "2023-06-01T00:00:00.000000",
+ "2023-07-01T00:00:00.000000",
+ "2023-08-01T00:00:00.000000",
+ "2023-09-01T00:00:00.000000",
+ "2023-10-01T00:00:00.000000",
+ "2023-11-01T00:00:00.000000",
+ "2023-12-01T00:00:00.000000",
+ "2024-01-01T00:00:00.000000",
+ "2024-02-01T00:00:00.000000",
+ "2024-03-01T00:00:00.000000",
+ "2024-04-01T00:00:00.000000",
+ "2024-05-01T00:00:00.000000",
+ "2024-06-01T00:00:00.000000",
+ "2024-07-01T00:00:00.000000",
+ "2024-08-01T00:00:00.000000",
+ "2024-09-01T00:00:00.000000",
+ "2024-10-01T00:00:00.000000",
+ "2024-11-01T00:00:00.000000",
+ "2024-12-01T00:00:00.000000",
+ "2025-01-01T00:00:00.000000",
+ "2025-02-01T00:00:00.000000",
+ "2025-03-01T00:00:00.000000",
+ "2025-04-01T00:00:00.000000",
+ "2025-05-01T00:00:00.000000",
+ "2025-06-01T00:00:00.000000",
+ "2025-07-01T00:00:00.000000",
+ "2025-08-01T00:00:00.000000",
+ "2025-09-01T00:00:00.000000",
+ "2025-10-01T00:00:00.000000",
+ "2025-11-01T00:00:00.000000"
+ ],
+ "y": {
+ "bdata": "AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fwAAAAAAAPh/AAAAAAAA+H8AAAAAAAD4fzm9zZIEiiNBmW4kNfe8I0GLAaIcdM4jQfM8B0Gk0iNBV44zCF3QI0Hjv+r5kwQkQeJRRlnLGyRB4TGEYz31I0FJnLzfceYjQZNSHu4UGCRBGyPKtB6KJEFnQAeI4vIkQQEGZNvWUCVBSJjFdjaDJUFHvu1kieUlQcEVt9WBMSZBP67PUKS+JkFZwpXreRAnQRmu8R+zdydB/Sdlap0YKEF97ma/XVcoQcitJVeimChB55Cwb+KTKEGw4nRZLGcoQa1SUJ6xSyhByPu+dwWnKEHEj1+jYOYoQSjUm/0w9yhBnzWpENTtKEGErezTHgcpQYMtF2AGBClBCzdEyxHwKEGjI0fCPhApQekBx85+MylBzaFcpegWKUGJ5GojTRQpQUM+HbWwJSlBHZ/qVc4iKUHBLIHz+csoQQBsaHZ23ylB38ROuLEHKkEU0hp0XtEpQVRgKdDXvylBPZGuT4iRKUGbBNXLj6opQQVr/1YGeSlBCO/Fj69hKUHJaYpeb3IpQXPO70shnSlByaJZksd0KUG82g0iQYcpQak3Py5AkChBQCIYWd7FKEGJIlGsD8MoQev4FZjZAilBtQaNbFkGKUG0MYbY6+goQS8TuceH7ClBpS1lilxLKkG96CUB+EYqQQthCII6AypBpR0x4t3jKUHniMmBMrspQeDAxtzVxSlBYD6qWKz1KEERE6RRtggpQdvUQDRklChBcQ0JENYCKUEdPjWm6TIpQWXcMGlAQyhB92Hg1GScKEFEQydCbd0oQVmmlyyZJylBa3sjHB2nKUHpPxt57d4pQYith70D2SlBLTabgaKSKkFb5I83UMIqQasQNPiyLStBMOEJr3LzKkGs5GrmcCwrQZHQ7VB6RStBMKkOp1DAKkFhZRkSn4UqQWMQMdpEPipBy9whq9/tKUEDJu0h09opQYGqXI6LCypBQZwNTkvPKUEPwIn/KM4pQaDqj3wHKypBj2rUXr/yKUGHKAKH5MkpQQd52pXQxylBWWC7fo3jKUGkmntfBPApQZwt0EJxECpB7KQ1q8YiKkHs0AytZzIqQVyYuuUTCypB86fnShMeKkE4yozYHfMpQeSIjrZVUClBF1IJAP1RKUE5y+m6eCspQXzqUqXJDClByaybWI/5KEFRno/3L9YoQa2pYnADpShBO23Mmrt1KEFTX1wd91soQffJB/w0zydBdVFp9F+vJ0EgsvG5irMnQWS+goH5hydBKM3Fliw8J0HMkXClvdwmQUPmvXz22CZBAQTZICqBJkFgjXRg9AomQQ==",
+ "dtype": "f8"
+ }
+ }
+ ],
+ "layout": {
+ "height": 500,
+ "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": "London: Monthly Price with 12-Month Rolling Average"
+ },
+ "xaxis": {
+ "title": {
+ "text": "Month"
+ }
+ },
+ "yaxis": {
+ "title": {
+ "text": "Average Price (£)"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "monthly_london_rolling = monthly_london.with_columns(pl.col(\"avg_price\").rolling_mean(window_size=12).alias(\"rolling_12m_avg\"))\n",
+ "\n",
+ "fig = go.Figure()\n",
+ "fig.add_trace(go.Scatter(x=monthly_london_rolling[\"month\"], y=monthly_london_rolling[\"avg_price\"], name=\"Monthly\", mode=\"lines\", opacity=0.5))\n",
+ "fig.add_trace(go.Scatter(x=monthly_london_rolling[\"month\"], y=monthly_london_rolling[\"rolling_12m_avg\"], name=\"12-Month Rolling Avg\", mode=\"lines\", line=dict(width=3, color=\"crimson\")))\n",
+ "fig.update_layout(title=\"London: Monthly Price with 12-Month Rolling Average\", xaxis_title=\"Month\", yaxis_title=\"Average Price (£)\", height=500)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "mode": "lines+markers",
+ "name": "National",
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "y": {
+ "bdata": "AAAAAAAAWUAjf6sJvlBaQFjaUBoA51xAjHl7uJpwX0BXSzGpqathQFw5JafYxmNAs6NjvLnfZUCvnPXPnGFpQNjiF/t8rmxA1oCwRBJ1cECvhP6U/2txQA0MEuk6uXJA/37PjSMudEAEweebRflzQD5DD2N3oXNA8uQ0waG3dUDqrj/MhWp1QKKBPAn37XVAE/fGrsCid0BIVrQ6wsJ5QLEs6AI+XHtAkYAkQTvbfECz5SJbi+d/QBfDOlFbLYBAjknbIp9WgEANhAusx1+BQNKmgzOD6IFADU0KVvoLg0BE9I69cKeCQM7Az6n4MIJAu/jAH5DogEA=",
+ "dtype": "f8"
+ }
+ },
+ {
+ "line": {
+ "color": "crimson"
+ },
+ "mode": "lines+markers",
+ "name": "London",
+ "type": "scatter",
+ "x": {
+ "bdata": "ywcAAMwHAADNBwAAzgcAAM8HAADQBwAA0QcAANIHAADTBwAA1AcAANUHAADWBwAA1wcAANgHAADZBwAA2gcAANsHAADcBwAA3QcAAN4HAADfBwAA4AcAAOEHAADiBwAA4wcAAOQHAADlBwAA5gcAAOcHAADoBwAA6QcAAA==",
+ "dtype": "i4"
+ },
+ "y": {
+ "bdata": "AAAAAAAAWUD/+cKkHfpaQP+qGmHdq15AjtriK1lIYUA9G89IFkRkQLVyrXbVJWhAsR2Wvu01akD7MJvzXNdtQDWLiNdME3BAs3xoy7OgcUA77iybA5NyQMjqNEuAN3RAzRftXP6QdkD8NOAzbyZ3QM3LTUy3MXdA4er1z/IaekC+COIMJv16QAxeUkltBXxA1pJvvJpjgED/AM72IMGCQBNARFnmlIRAi29RyZlOhkAvLVlGL3eJQFxa4XOFQYpArprtFl3IikA+ERdF0EiLQMlUhQ7hlYlA+1V8QKJri0C9aFIKxVyLQDJP1CBPuolAQYXhSAushkA=",
+ "dtype": "f8"
+ }
+ }
+ ],
+ "layout": {
+ "annotations": [
+ {
+ "showarrow": false,
+ "text": "1995 Baseline",
+ "x": 1,
+ "xanchor": "right",
+ "xref": "x domain",
+ "y": 100,
+ "yanchor": "bottom",
+ "yref": "y"
+ }
+ ],
+ "height": 500,
+ "shapes": [
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 0,
+ "x1": 1,
+ "xref": "x domain",
+ "y0": 100,
+ "y1": 100,
+ "yref": "y"
+ }
+ ],
+ "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": "Price Index (1995 = 100)"
+ },
+ "xaxis": {
+ "title": {
+ "text": "Year"
+ }
+ },
+ "yaxis": {
+ "title": {
+ "text": "Index"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "base_price_national = yearly_national.filter(pl.col(\"year\") == 1995)[\"avg_price\"][0]\n",
+ "base_price_london = yearly_london.filter(pl.col(\"year\") == 1995)[\"avg_price\"][0]\n",
+ "\n",
+ "yearly_indexed = yearly_national.with_columns(\n",
+ " (pl.col(\"avg_price\") / base_price_national * 100).alias(\"national_index\")\n",
+ ").join(\n",
+ " yearly_london.with_columns((pl.col(\"avg_price\") / base_price_london * 100).alias(\"london_index\")).select(\"year\", \"london_index\"),\n",
+ " on=\"year\"\n",
+ ")\n",
+ "\n",
+ "fig = go.Figure()\n",
+ "fig.add_trace(go.Scatter(x=yearly_indexed[\"year\"], y=yearly_indexed[\"national_index\"], name=\"National\", mode=\"lines+markers\"))\n",
+ "fig.add_trace(go.Scatter(x=yearly_indexed[\"year\"], y=yearly_indexed[\"london_index\"], name=\"London\", mode=\"lines+markers\", line=dict(color=\"crimson\")))\n",
+ "fig.add_hline(y=100, line_dash=\"dash\", line_color=\"gray\", annotation_text=\"1995 Baseline\")\n",
+ "fig.update_layout(title=\"Price Index (1995 = 100)\", xaxis_title=\"Year\", yaxis_title=\"Index\", height=500)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "---\n",
+ "## 4. Borough Selection Guide for Property Buyers\n",
+ "\n",
+ "Analysis to help choose which London borough to buy in, considering affordability, growth, market activity, and property mix."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "Sales Volume=1212
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "1212",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "1212",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAICEDkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BARKING AND DAGENHAM"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2046
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2046",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2046",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAAC9D0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BEXLEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2073
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2073",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2073",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAKAsEEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HAVERING"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4607
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4607",
+ "marker": {
+ "color": "#ab63fa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4607",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAMD3EEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CROYDON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2617
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2617",
+ "marker": {
+ "color": "#FFA15A",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2617",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAACBlEUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "SUTTON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2171
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2171",
+ "marker": {
+ "color": "#19d3f3",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2171",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAIBPEkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "REDBRIDGE"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2510
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2510",
+ "marker": {
+ "color": "#FF6692",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2510",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAKCdEkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HILLINGDON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2687
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2687",
+ "marker": {
+ "color": "#B6E880",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2687",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAABC1EkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "ENFIELD"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=3927
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "3927",
+ "marker": {
+ "color": "#FF97FF",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "3927",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAACDWE0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BROMLEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2249
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2249",
+ "marker": {
+ "color": "#FECB52",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2249",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAMBiFEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HARROW"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=3068
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "3068",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "3068",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAACp1FUE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HOUNSLOW"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4969
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4969",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4969",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAKCFFkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "LEWISHAM"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2424
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2424",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2424",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAKB/F0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "KINGSTON UPON THAMES"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=2864
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "2864",
+ "marker": {
+ "color": "#ab63fa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "2864",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAMiiF0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "MERTON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=3626
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "3626",
+ "marker": {
+ "color": "#FFA15A",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "3626",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAMDNF0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "WALTHAM FOREST"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4446
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4446",
+ "marker": {
+ "color": "#19d3f3",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4446",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAOAbGEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "GREENWICH"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=5570
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "5570",
+ "marker": {
+ "color": "#FF6692",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "5570",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAANA/GEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BARNET"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=3374
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "3374",
+ "marker": {
+ "color": "#B6E880",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "3374",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAMxhGEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BRENT"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=3649
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "3649",
+ "marker": {
+ "color": "#FF97FF",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "3649",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAABqGEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "NEWHAM"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4827
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4827",
+ "marker": {
+ "color": "#FECB52",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4827",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAMDHGEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "EALING"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4295
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4295",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4295",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAEB3G0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HARINGEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=3069
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "3069",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "3069",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAKBhHEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "RICHMOND UPON THAMES"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=7586
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "7586",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "7586",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAKBhHEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "LAMBETH"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=7611
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "7611",
+ "marker": {
+ "color": "#ab63fa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "7611",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAKBhHEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "TOWER HAMLETS"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=6605
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "6605",
+ "marker": {
+ "color": "#FFA15A",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "6605",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAADPHEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "SOUTHWARK"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=5328
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "5328",
+ "marker": {
+ "color": "#19d3f3",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "5328",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAJAFIEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HACKNEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=9760
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "9760",
+ "marker": {
+ "color": "#FF6692",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "9760",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAANChIEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "WANDSWORTH"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4979
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4979",
+ "marker": {
+ "color": "#B6E880",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4979",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAAARIkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "ISLINGTON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4955
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4955",
+ "marker": {
+ "color": "#FF97FF",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4955",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAACII0E=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HAMMERSMITH AND FULHAM"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4987
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4987",
+ "marker": {
+ "color": "#FECB52",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4987",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAHCZJEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CAMDEN"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=557
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "557",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "557",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAANJHKEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CITY OF LONDON"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=6628
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "6628",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "6628",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAIxPKkE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CITY OF WESTMINSTER"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Sales Volume=4047
Median Price (£)=%{x}
Borough=%{y}",
+ "legendgroup": "4047",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "4047",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAOD9LEE=",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "KENSINGTON AND CHELSEA"
+ ],
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "barmode": "relative",
+ "height": 800,
+ "legend": {
+ "title": {
+ "text": "Sales Volume"
+ },
+ "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": "Current Median Flat Prices by Borough (2023+)"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Median Price (£)"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "categoryorder": "total ascending",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Borough"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Current median prices by property type for each borough\n",
+ "borough_by_type = (\n",
+ " lf.filter(LONDON_FILTER)\n",
+ " .filter(pl.col(\"date_of_transfer\").dt.year() >= 2023)\n",
+ " .group_by(\"district\", \"property_type\")\n",
+ " .agg(pl.col(\"price\").median().alias(\"median_price\"), pl.len().alias(\"count\"))\n",
+ " .with_columns(pl.col(\"property_type\").replace(PROPERTY_TYPE_MAP).alias(\"type_name\"))\n",
+ " .collect()\n",
+ ")\n",
+ "\n",
+ "flats_by_borough = borough_by_type.filter(pl.col(\"property_type\") == \"F\").sort(\"median_price\")\n",
+ "\n",
+ "fig = px.bar(flats_by_borough.to_pandas(), x=\"median_price\", y=\"district\", orientation=\"h\",\n",
+ " title=\"Current Median Flat Prices by Borough (2023+)\",\n",
+ " color=\"count\", color_continuous_scale=\"Viridis\",\n",
+ " labels={\"median_price\": \"Median Price (£)\", \"district\": \"Borough\", \"count\": \"Sales Volume\"})\n",
+ "fig.update_layout(yaxis={\"categoryorder\": \"total ascending\"}, height=800)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "coloraxis": "coloraxis",
+ "hovertemplate": "x: %{x}
y: %{y}
Price (£): %{z}",
+ "name": "0",
+ "type": "heatmap",
+ "x": [
+ "Flat",
+ "Terraced",
+ "Semi-detached",
+ "Detached"
+ ],
+ "xaxis": "x",
+ "y": [
+ "BARKING AND DAGENHAM",
+ "BEXLEY",
+ "HAVERING",
+ "CROYDON",
+ "SUTTON",
+ "REDBRIDGE",
+ "HILLINGDON",
+ "ENFIELD",
+ "BROMLEY",
+ "HARROW",
+ "HOUNSLOW",
+ "LEWISHAM",
+ "KINGSTON UPON THAMES",
+ "MERTON",
+ "WALTHAM FOREST",
+ "GREENWICH",
+ "BARNET",
+ "BRENT",
+ "NEWHAM",
+ "EALING",
+ "HARINGEY",
+ "RICHMOND UPON THAMES",
+ "LAMBETH",
+ "TOWER HAMLETS",
+ "SOUTHWARK",
+ "HACKNEY",
+ "WANDSWORTH",
+ "ISLINGTON",
+ "HAMMERSMITH AND FULHAM",
+ "CAMDEN",
+ "CITY OF LONDON",
+ "CITY OF WESTMINSTER",
+ "KENSINGTON AND CHELSEA"
+ ],
+ "yaxis": "y",
+ "z": {
+ "bdata": "AAAAAICEDkEAAAAAoH8XQQAAAACAohlBAAAAAOB0HkEAAAAAAL0PQQAAAAAguBhBAAAAAABMHUEAAAAAaE0jQQAAAACgLBBBAAAAAKDwGUEAAAAAIJodQQAAAAAAiCNBAAAAAMD3EEEAAAAAoPAZQQAAAACwUyBBAAAAAKSuJkEAAAAAIGURQQAAAADg/RxBAAAAAByzIkEAAAAAsBcqQQAAAACATxJBAAAAAJAFIEEAAAAAwOsiQQAAAAAQAitBAAAAAKCdEkEAAAAAAEwdQQAAAADQoSBBAAAAAOAbKEEAAAAAELUSQQAAAACgYRxBAAAAADx+I0EAAAAAgIQuQQAAAAAg1hNBAAAAAICEHkEAAAAAkHYiQQAAAADwNipBAAAAAMBiFEEAAAAAsFMgQQAAAAB29yJBAAAAAFAPLkEAAAAAKnUVQQAAAAAAvR9BAAAAAPDvIEEAAAAAIEcmQQAAAACghRZBAAAAAJB2IkEAAAAAECAmQQAAAABYeSpBAAAAAKB/F0EAAAAAABchQQAAAAAQICZBAAAAAODIMEEAAAAAyKIXQQAAAADA6yJBAAAAALCmJ0EAAAAArFM+QQAAAADAzRdBAAAAANASI0EAAAAAINYjQQAAAABYCChBAAAAAOAbGEEAAAAA4P0cQQAAAAAAFyFBAAAAAJgzJkEAAAAA0D8YQQAAAAAgWSNBAAAAAPBCKEEAAAAAINYzQQAAAADMYRhBAAAAACDWI0EAAAAAINYjQQAAAABw7CtBAAAAAABqGEEAAAAAQHcbQQAAAAAgmh1BAAAAABA+IUEAAAAAwMcYQQAAAADQEiNBAAAAAKAOJUEAAAAAINYzQQAAAABAdxtBAAAAAOCqJUEAAAAANoUyQQAAAAA4nDxBAAAAAKBhHEEAAAAAwD4qQQAAAADgbi9BAAAAALIUOEEAAAAAoGEcQQAAAACAoilBAAAAAGA2LkEAAAAAQCQ0QQAAAACgYRxBAAAAACC4KEEAAAAAfHkpQQAAAABwKDJBAAAAAADPHEEAAAAA8LMqQQAAAAA2hTJBAAAAALA1NUEAAAAAkAUgQQAAAADgyDBBAAAAAMBcNUEAAAAAQAY5QQAAAADQoSBBAAAAAMAgL0EAAAAAYOM2QQAAAACIKkFBAAAAAAARIkEAAAAAKKU0QQAAAAAUqDtBAAAAAODIQEEAAAAAAIgjQQAAAADAXDVBAAAAAGqCOEEAAAAAyIo7QQAAAABwmSRBAAAAAOAVOUEAAAAAGtdDQQAAAAC0Lk1BAAAAANJHKEEAAAAAeCw/QQAAAAAAAPh/AAAAAAAA+H8AAAAAjE8qQQAAAAASkUFBAAAAANqxVEEAAAAAqMtYQQAAAADg/SxBAAAAAGDjRkEAAAAA1fxZQQAAAAAheV9B",
+ "dtype": "f8",
+ "shape": "33, 4"
+ }
+ }
+ ],
+ "layout": {
+ "coloraxis": {
+ "colorbar": {
+ "title": {
+ "text": "Price (£)"
+ }
+ },
+ "colorscale": [
+ [
+ 0,
+ "rgb(0,104,55)"
+ ],
+ [
+ 0.1,
+ "rgb(26,152,80)"
+ ],
+ [
+ 0.2,
+ "rgb(102,189,99)"
+ ],
+ [
+ 0.3,
+ "rgb(166,217,106)"
+ ],
+ [
+ 0.4,
+ "rgb(217,239,139)"
+ ],
+ [
+ 0.5,
+ "rgb(255,255,191)"
+ ],
+ [
+ 0.6,
+ "rgb(254,224,139)"
+ ],
+ [
+ 0.7,
+ "rgb(253,174,97)"
+ ],
+ [
+ 0.8,
+ "rgb(244,109,67)"
+ ],
+ [
+ 0.9,
+ "rgb(215,48,39)"
+ ],
+ [
+ 1,
+ "rgb(165,0,38)"
+ ]
+ ]
+ },
+ "height": 900,
+ "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": "Median Price by Borough and Property Type (2023+)"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ]
+ },
+ "yaxis": {
+ "anchor": "x",
+ "autorange": "reversed",
+ "domain": [
+ 0,
+ 1
+ ]
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Heatmap: Price by borough and property type\n",
+ "pivot_data = borough_by_type.pivot(on=\"type_name\", index=\"district\", values=\"median_price\").sort(\"Flat/Maisonette\", nulls_last=True)\n",
+ "\n",
+ "fig = px.imshow(\n",
+ " pivot_data.select([\"Flat/Maisonette\", \"Terraced\", \"Semi-detached\", \"Detached\"]).to_pandas(),\n",
+ " y=pivot_data[\"district\"].to_list(),\n",
+ " x=[\"Flat\", \"Terraced\", \"Semi-detached\", \"Detached\"],\n",
+ " color_continuous_scale=\"RdYlGn_r\", aspect=\"auto\",\n",
+ " title=\"Median Price by Borough and Property Type (2023+)\", labels={\"color\": \"Price (£)\"})\n",
+ "fig.update_layout(height=900)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (33, 6)| district | price_2014 | price_2019 | price_2024 | cagr_10yr | cagr_5yr |
|---|
| str | f64 | f64 | f64 | f64 | f64 |
| "HAVERING" | 250000.0 | 360000.0 | 430000.0 | 5.572996 | 3.617519 |
| "BEXLEY" | 250000.0 | 350000.0 | 415000.0 | 5.198806 | 3.465607 |
| "HILLINGDON" | 302250.0 | 405000.0 | 480000.0 | 4.733952 | 3.456372 |
| "SUTTON" | 285000.0 | 380000.0 | 445750.0 | 4.574224 | 3.243222 |
| "REDBRIDGE" | 298300.0 | 405000.0 | 475000.0 | 4.762061 | 3.239934 |
| "HOUNSLOW" | 315000.0 | 400000.0 | 466000.0 | 3.993821 | 3.101548 |
| "BARKING AND DAGENHAM" | 215000.0 | 310000.0 | 360000.0 | 5.289825 | 3.035803 |
| "HARROW" | 365000.0 | 440000.0 | 510000.0 | 3.401712 | 2.996745 |
| "ENFIELD" | 280000.0 | 385000.0 | 446000.0 | 4.765354 | 2.985202 |
| "WALTHAM FOREST" | 317408.5 | 440625.0 | 504000.0 | 4.732434 | 2.724085 |
| … | … | … | … | … | … |
| "WANDSWORTH" | 528000.0 | 610000.0 | 635000.0 | 1.862418 | 0.806556 |
| "GREENWICH" | 300000.0 | 435000.0 | 450000.0 | 4.137974 | 0.680335 |
| "CAMDEN" | 670000.0 | 760000.0 | 780000.0 | 1.531775 | 0.520862 |
| "SOUTHWARK" | 415000.0 | 540000.0 | 552000.0 | 2.893774 | 0.440546 |
| "TOWER HAMLETS" | 380000.0 | 485000.0 | 492500.0 | 2.627149 | 0.307383 |
| "KENSINGTON AND CHELSEA" | 1.195e6 | 1.2e6 | 1.2e6 | 0.041762 | 0.0 |
| "LAMBETH" | 418000.0 | 530000.0 | 530000.0 | 2.402358 | 0.0 |
| "CITY OF WESTMINSTER" | 885000.0 | 960000.0 | 956000.0 | 0.774688 | -0.083473 |
| "HACKNEY" | 434847.5 | 600000.0 | 590000.0 | 3.0983 | -0.335578 |
| "CITY OF LONDON" | 790000.0 | 950000.0 | 901250.0 | 1.326215 | -1.048055 |
"
+ ],
+ "text/plain": [
+ "shape: (33, 6)\n",
+ "┌────────────────────────┬────────────┬────────────┬────────────┬───────────┬───────────┐\n",
+ "│ district ┆ price_2014 ┆ price_2019 ┆ price_2024 ┆ cagr_10yr ┆ cagr_5yr │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ str ┆ f64 ┆ f64 ┆ f64 ┆ f64 ┆ f64 │\n",
+ "╞════════════════════════╪════════════╪════════════╪════════════╪═══════════╪═══════════╡\n",
+ "│ HAVERING ┆ 250000.0 ┆ 360000.0 ┆ 430000.0 ┆ 5.572996 ┆ 3.617519 │\n",
+ "│ BEXLEY ┆ 250000.0 ┆ 350000.0 ┆ 415000.0 ┆ 5.198806 ┆ 3.465607 │\n",
+ "│ HILLINGDON ┆ 302250.0 ┆ 405000.0 ┆ 480000.0 ┆ 4.733952 ┆ 3.456372 │\n",
+ "│ SUTTON ┆ 285000.0 ┆ 380000.0 ┆ 445750.0 ┆ 4.574224 ┆ 3.243222 │\n",
+ "│ REDBRIDGE ┆ 298300.0 ┆ 405000.0 ┆ 475000.0 ┆ 4.762061 ┆ 3.239934 │\n",
+ "│ HOUNSLOW ┆ 315000.0 ┆ 400000.0 ┆ 466000.0 ┆ 3.993821 ┆ 3.101548 │\n",
+ "│ BARKING AND DAGENHAM ┆ 215000.0 ┆ 310000.0 ┆ 360000.0 ┆ 5.289825 ┆ 3.035803 │\n",
+ "│ HARROW ┆ 365000.0 ┆ 440000.0 ┆ 510000.0 ┆ 3.401712 ┆ 2.996745 │\n",
+ "│ ENFIELD ┆ 280000.0 ┆ 385000.0 ┆ 446000.0 ┆ 4.765354 ┆ 2.985202 │\n",
+ "│ WALTHAM FOREST ┆ 317408.5 ┆ 440625.0 ┆ 504000.0 ┆ 4.732434 ┆ 2.724085 │\n",
+ "│ … ┆ … ┆ … ┆ … ┆ … ┆ … │\n",
+ "│ WANDSWORTH ┆ 528000.0 ┆ 610000.0 ┆ 635000.0 ┆ 1.862418 ┆ 0.806556 │\n",
+ "│ GREENWICH ┆ 300000.0 ┆ 435000.0 ┆ 450000.0 ┆ 4.137974 ┆ 0.680335 │\n",
+ "│ CAMDEN ┆ 670000.0 ┆ 760000.0 ┆ 780000.0 ┆ 1.531775 ┆ 0.520862 │\n",
+ "│ SOUTHWARK ┆ 415000.0 ┆ 540000.0 ┆ 552000.0 ┆ 2.893774 ┆ 0.440546 │\n",
+ "│ TOWER HAMLETS ┆ 380000.0 ┆ 485000.0 ┆ 492500.0 ┆ 2.627149 ┆ 0.307383 │\n",
+ "│ KENSINGTON AND CHELSEA ┆ 1.195e6 ┆ 1.2e6 ┆ 1.2e6 ┆ 0.041762 ┆ 0.0 │\n",
+ "│ LAMBETH ┆ 418000.0 ┆ 530000.0 ┆ 530000.0 ┆ 2.402358 ┆ 0.0 │\n",
+ "│ CITY OF WESTMINSTER ┆ 885000.0 ┆ 960000.0 ┆ 956000.0 ┆ 0.774688 ┆ -0.083473 │\n",
+ "│ HACKNEY ┆ 434847.5 ┆ 600000.0 ┆ 590000.0 ┆ 3.0983 ┆ -0.335578 │\n",
+ "│ CITY OF LONDON ┆ 790000.0 ┆ 950000.0 ┆ 901250.0 ┆ 1.326215 ┆ -1.048055 │\n",
+ "└────────────────────────┴────────────┴────────────┴────────────┴───────────┴───────────┘"
+ ]
+ },
+ "execution_count": 21,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# 5-Year and 10-Year Price Growth by Borough (CAGR)\n",
+ "def calculate_cagr(start_price, end_price, years):\n",
+ " if start_price > 0 and end_price > 0:\n",
+ " return ((end_price / start_price) ** (1 / years) - 1) * 100\n",
+ " return None\n",
+ "\n",
+ "borough_yearly_all = (\n",
+ " lf.filter(LONDON_FILTER)\n",
+ " .with_columns(pl.col(\"date_of_transfer\").dt.year().alias(\"year\"))\n",
+ " .group_by(\"district\", \"year\")\n",
+ " .agg(pl.col(\"price\").median().alias(\"median_price\"))\n",
+ " .collect()\n",
+ ")\n",
+ "\n",
+ "years_needed = [2014, 2019, 2024]\n",
+ "growth_data = []\n",
+ "for borough in london_boroughs[\"district\"].to_list():\n",
+ " borough_data = borough_yearly_all.filter(pl.col(\"district\") == borough)\n",
+ " prices = {}\n",
+ " for year in years_needed:\n",
+ " year_data = borough_data.filter(pl.col(\"year\") == year)\n",
+ " if len(year_data) > 0:\n",
+ " prices[year] = year_data[\"median_price\"][0]\n",
+ " if all(year in prices for year in years_needed):\n",
+ " growth_data.append({\"district\": borough, \"price_2014\": prices[2014], \"price_2019\": prices[2019], \"price_2024\": prices[2024],\n",
+ " \"cagr_10yr\": calculate_cagr(prices[2014], prices[2024], 10), \"cagr_5yr\": calculate_cagr(prices[2019], prices[2024], 5)})\n",
+ "\n",
+ "growth_df = pl.DataFrame(growth_data).sort(\"cagr_5yr\", descending=True)\n",
+ "growth_df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "10-Year CAGR (%)=%{x}
5-Year CAGR (%)=%{y}
district=%{text}
price_2024=%{marker.color}",
+ "legendgroup": "",
+ "marker": {
+ "color": {
+ "bdata": "AAAAAMA+GkEAAAAAYFQZQQAAAAAATB1BAAAAANg0G0EAAAAA4P0cQQAAAABAcRxBAAAAAAD5FUEAAAAAwCAfQQAAAADAOBtBAAAAAADDHkEAAAAAkAUgQQAAAAAAvR9BAAAAAABMHUEAAAAAkAUgQQAAAABgciRBAAAAAKDSHkEAAAAA2AMlQQAAAACQWCdBAAAAANChIEEAAAAAQHcbQQAAAABoXyBBAAAAAABqGEEAAAAA4IwaQQAAAADwYCNBAAAAAEB3G0EAAAAAwM0nQQAAAACA2CBBAAAAAFAPHkEAAAAAgE8yQQAAAACgLCBBAAAAAMAsLUEAAAAAYAEiQQAAAAAEgStB",
+ "dtype": "f8"
+ },
+ "coloraxis": "coloraxis",
+ "symbol": "circle"
+ },
+ "mode": "markers+text",
+ "name": "",
+ "orientation": "v",
+ "showlegend": false,
+ "text": [
+ "HAVERING",
+ "BEXLEY",
+ "HILLINGDON",
+ "SUTTON",
+ "REDBRIDGE",
+ "HOUNSLOW",
+ "BARKING AND DAGENHAM",
+ "HARROW",
+ "ENFIELD",
+ "WALTHAM FOREST",
+ "BRENT",
+ "MERTON",
+ "BROMLEY",
+ "KINGSTON UPON THAMES",
+ "ISLINGTON",
+ "EALING",
+ "RICHMOND UPON THAMES",
+ "HAMMERSMITH AND FULHAM",
+ "BARNET",
+ "LEWISHAM",
+ "HARINGEY",
+ "CROYDON",
+ "NEWHAM",
+ "WANDSWORTH",
+ "GREENWICH",
+ "CAMDEN",
+ "SOUTHWARK",
+ "TOWER HAMLETS",
+ "KENSINGTON AND CHELSEA",
+ "LAMBETH",
+ "CITY OF WESTMINSTER",
+ "HACKNEY",
+ "CITY OF LONDON"
+ ],
+ "textfont": {
+ "size": 8
+ },
+ "textposition": "top center",
+ "type": "scatter",
+ "x": {
+ "bdata": "396xW79KFkBpaiKvk8sUQBE1ojOR7xJAfqwwSgFMEkBxh+rVWQwTQKSQCYNY8w9AdYw/5scoFUCIHE0CtTYLQF1DFNS4DxNAWBtKSAPuEkDqX6eV1UcKQBZBUZ76RQlAdo6dNOTqDUA+VLQJgTMJQOZqJu91NAJAcJI8G5kABkBou2cYGQAGQJzFOXJECPk/vpVscxiyCkDirQSwZGAOQLYsMzq/2AdAyITNLZybEUBbvGzQzMcWQLgjyJZ2zP0/07MxKUmNEEDwGnnTJoL4P1ylECRzJgdAhmDYomYEBUAAMtew4mGlP+aaiqsHOANACKFAcj7K6D88WAFpUckIQFzUp98sOPU/",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": {
+ "bdata": "gN0Z/63wDEDsd/c5kLkLQGC0hCampgtAZNkPkh7yCUC2IwNmYusJQBJlO0n4zwhAPKvyPlNJCEDAxcBwVfkHQH4+M6ux4QdApj468OzKBUAociLx8W0FQJ4+6k6/wARAajidLd21A0AcLVOgZecBQCblB+IZ2gFAtKc+Rmg3AUAa2Gu0BvkAQAT7QzAaq/w/lCCK2N3Q+z8kKmBdY7H7P/iqukkgvfY/IGxVsUPJ9D9AfzetkA3zP9hpXcROz+k/+M38oE3F5T8ITCDH5argPyAjd5PmMdw/QCeiHCms0z8AAAAAAAAAAAAAAAAAAAAAwI49WHVetb8QAihRHHrVv7JAlHjVxPC/",
+ "dtype": "f8"
+ },
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "coloraxis": {
+ "colorbar": {
+ "title": {
+ "text": "price_2024"
+ }
+ },
+ "colorscale": [
+ [
+ 0,
+ "#440154"
+ ],
+ [
+ 0.1111111111111111,
+ "#482878"
+ ],
+ [
+ 0.2222222222222222,
+ "#3e4989"
+ ],
+ [
+ 0.3333333333333333,
+ "#31688e"
+ ],
+ [
+ 0.4444444444444444,
+ "#26828e"
+ ],
+ [
+ 0.5555555555555556,
+ "#1f9e89"
+ ],
+ [
+ 0.6666666666666666,
+ "#35b779"
+ ],
+ [
+ 0.7777777777777778,
+ "#6ece58"
+ ],
+ [
+ 0.8888888888888888,
+ "#b5de2b"
+ ],
+ [
+ 1,
+ "#fde725"
+ ]
+ ]
+ },
+ "height": 700,
+ "legend": {
+ "tracegroupgap": 0
+ },
+ "shapes": [
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 0,
+ "x1": 1,
+ "xref": "x domain",
+ "y0": 0,
+ "y1": 0,
+ "yref": "y"
+ },
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 0,
+ "x1": 0,
+ "xref": "x",
+ "y0": 0,
+ "y1": 1,
+ "yref": "y domain"
+ }
+ ],
+ "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": "Borough Price Growth: 5-Year vs 10-Year CAGR"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "10-Year CAGR (%)"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "5-Year CAGR (%)"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# 5-year vs 10-year CAGR scatter\n",
+ "fig = px.scatter(growth_df.to_pandas(), x=\"cagr_10yr\", y=\"cagr_5yr\", text=\"district\",\n",
+ " title=\"Borough Price Growth: 5-Year vs 10-Year CAGR\",\n",
+ " labels={\"cagr_10yr\": \"10-Year CAGR (%)\", \"cagr_5yr\": \"5-Year CAGR (%)\"},\n",
+ " color=\"price_2024\", color_continuous_scale=\"Viridis\")\n",
+ "fig.update_traces(textposition=\"top center\", textfont_size=8)\n",
+ "fig.add_hline(y=0, line_dash=\"dash\", line_color=\"gray\")\n",
+ "fig.add_vline(x=0, line_dash=\"dash\", line_color=\"gray\")\n",
+ "fig.update_layout(height=700)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "5-Year CAGR (%)=%{marker.color}
Borough=%{y}",
+ "legendgroup": "",
+ "marker": {
+ "color": {
+ "bdata": "skCUeNXE8L8QAihRHHrVv8COPVh1XrW/AAAAAAAAAAAAAAAAAAAAAEAnohwprNM/ICN3k+Yx3D8ITCDH5argP/jN/KBNxeU/2GldxE7P6T9AfzetkA3zPyBsVbFDyfQ/+Kq6SSC99j8kKmBdY7H7P5Qgitjd0Ps/BPtDMBqr/D8a2Gu0BvkAQLSnPkZoNwFAJuUH4hnaAUAcLVOgZecBQGo4nS3dtQNAnj7qTr/ABEAociLx8W0FQKY+OvDsygVAfj4zq7HhB0DAxcBwVfkHQDyr8j5TSQhAEmU7SfjPCEC2IwNmYusJQGTZD5Ie8glAYLSEJqamC0Dsd/c5kLkLQIDdGf+t8AxA",
+ "dtype": "f8"
+ },
+ "coloraxis": "coloraxis",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "",
+ "orientation": "h",
+ "showlegend": false,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "skCUeNXE8L8QAihRHHrVv8COPVh1XrW/AAAAAAAAAAAAAAAAAAAAAEAnohwprNM/ICN3k+Yx3D8ITCDH5argP/jN/KBNxeU/2GldxE7P6T9AfzetkA3zPyBsVbFDyfQ/+Kq6SSC99j8kKmBdY7H7P5Qgitjd0Ps/BPtDMBqr/D8a2Gu0BvkAQLSnPkZoNwFAJuUH4hnaAUAcLVOgZecBQGo4nS3dtQNAnj7qTr/ABEAociLx8W0FQKY+OvDsygVAfj4zq7HhB0DAxcBwVfkHQDyr8j5TSQhAEmU7SfjPCEC2IwNmYusJQGTZD5Ie8glAYLSEJqamC0Dsd/c5kLkLQIDdGf+t8AxA",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CITY OF LONDON",
+ "HACKNEY",
+ "CITY OF WESTMINSTER",
+ "LAMBETH",
+ "KENSINGTON AND CHELSEA",
+ "TOWER HAMLETS",
+ "SOUTHWARK",
+ "CAMDEN",
+ "GREENWICH",
+ "WANDSWORTH",
+ "NEWHAM",
+ "CROYDON",
+ "HARINGEY",
+ "LEWISHAM",
+ "BARNET",
+ "HAMMERSMITH AND FULHAM",
+ "RICHMOND UPON THAMES",
+ "EALING",
+ "ISLINGTON",
+ "KINGSTON UPON THAMES",
+ "BROMLEY",
+ "MERTON",
+ "BRENT",
+ "WALTHAM FOREST",
+ "ENFIELD",
+ "HARROW",
+ "BARKING AND DAGENHAM",
+ "HOUNSLOW",
+ "REDBRIDGE",
+ "SUTTON",
+ "HILLINGDON",
+ "BEXLEY",
+ "HAVERING"
+ ],
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "barmode": "relative",
+ "coloraxis": {
+ "colorbar": {
+ "title": {
+ "text": "5-Year CAGR (%)"
+ }
+ },
+ "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": 800,
+ "legend": {
+ "tracegroupgap": 0
+ },
+ "shapes": [
+ {
+ "line": {
+ "color": "black",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 0,
+ "x1": 0,
+ "xref": "x",
+ "y0": 0,
+ "y1": 1,
+ "yref": "y domain"
+ }
+ ],
+ "showlegend": false,
+ "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": "5-Year Price Growth by Borough (CAGR %)"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "5-Year CAGR (%)"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "categoryorder": "total ascending",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Borough"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# 5-Year Price Growth Ranking\n",
+ "fig = px.bar(growth_df.sort(\"cagr_5yr\").to_pandas(), x=\"cagr_5yr\", y=\"district\", orientation=\"h\",\n",
+ " title=\"5-Year Price Growth by Borough (CAGR %)\", color=\"cagr_5yr\", color_continuous_scale=\"RdYlGn\",\n",
+ " labels={\"cagr_5yr\": \"5-Year CAGR (%)\", \"district\": \"Borough\"})\n",
+ "fig.add_vline(x=0, line_dash=\"dash\", line_color=\"black\")\n",
+ "fig.update_layout(yaxis={\"categoryorder\": \"total ascending\"}, height=800, showlegend=False)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "Property Type=Flat/Maisonette
% of Transactions=%{x}
Borough=%{y}",
+ "legendgroup": "Flat/Maisonette",
+ "marker": {
+ "color": "#636efa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "Flat/Maisonette",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "TNHWu3IsU0AVGL70LeNCQOnhY+/6E0hA7COwqp0KUUAAV/jZr+NKQDIQVmIHRUBApl6CT7R5UkBXiYvZKtFSQD5lr7Am1D9ArDAL0tz6S0BEkxDOpYhFQFkvpYsYukpAkhaOAoSkSkDkl1gK05NQQI32deNeCD5A+lWiwSrUQ0CEcgySoPVIQB35YLuRHVZAdiOcaIoaREDFjLZfCZhGQCkJ0Lcb6EJAB1I/dOlMU0Bm2pHswZtRQCKRNZ4mpktAVy2Y9imsUUDqiHfQLHk2QJYQkPNTCTxAl9ImA55DQ0A1jmAfE/pCQG0KJsJOeVFAODUJuXhEOkDr1gAQQVhBQFIRfb90CFNA",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "CITY OF WESTMINSTER",
+ "HARROW",
+ "BARNET",
+ "HAMMERSMITH AND FULHAM",
+ "GREENWICH",
+ "HILLINGDON",
+ "ISLINGTON",
+ "CAMDEN",
+ "BROMLEY",
+ "HARINGEY",
+ "WALTHAM FOREST",
+ "BRENT",
+ "LEWISHAM",
+ "WANDSWORTH",
+ "REDBRIDGE",
+ "MERTON",
+ "EALING",
+ "TOWER HAMLETS",
+ "KINGSTON UPON THAMES",
+ "HOUNSLOW",
+ "SUTTON",
+ "CITY OF LONDON",
+ "SOUTHWARK",
+ "NEWHAM",
+ "LAMBETH",
+ "HAVERING",
+ "BARKING AND DAGENHAM",
+ "RICHMOND UPON THAMES",
+ "CROYDON",
+ "KENSINGTON AND CHELSEA",
+ "BEXLEY",
+ "ENFIELD",
+ "HACKNEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Property Type=Detached
% of Transactions=%{x}
Borough=%{y}",
+ "legendgroup": "Detached",
+ "marker": {
+ "color": "#EF553B",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "Detached",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "WfXZSN/bIkBnloyDAf0GQJsmRqRSFfM/rUe2si4aE0A66QFXC5IRQO15T9J1tvA/nHzPklwnsj90Z65JGr3tP0KjQxni+r8/+HMSZDLW+j9jw1UnjyouQAsarqogJ+g/4y6jcHx02D9c5qgf+Y8ZQK8MXhjacyJA32TLlJFc4j+JQEK563AgQGimDN6ZgCNAEGEavplHJkDwD+plKXwKQEIkhz2I5Pg/8FaxxzOM1j+oDOpOzpQkQPDVIjv/CQ5ACzdxUOh1IECDq1TdV2nyP0uCWWO9ORdAd4kk09sD8D9MBY4wa5IGQHQMhETWeNo/Z9eCPl8v0j+Ea4LWMqAAQEfORwDxV/c/",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "KINGSTON UPON THAMES",
+ "EALING",
+ "SOUTHWARK",
+ "ENFIELD",
+ "REDBRIDGE",
+ "WANDSWORTH",
+ "TOWER HAMLETS",
+ "BARKING AND DAGENHAM",
+ "CITY OF LONDON",
+ "LEWISHAM",
+ "BROMLEY",
+ "KENSINGTON AND CHELSEA",
+ "HAMMERSMITH AND FULHAM",
+ "RICHMOND UPON THAMES",
+ "HARROW",
+ "CITY OF WESTMINSTER",
+ "SUTTON",
+ "HAVERING",
+ "HILLINGDON",
+ "BRENT",
+ "CAMDEN",
+ "ISLINGTON",
+ "CROYDON",
+ "MERTON",
+ "BARNET",
+ "WALTHAM FOREST",
+ "BEXLEY",
+ "LAMBETH",
+ "HOUNSLOW",
+ "NEWHAM",
+ "HACKNEY",
+ "GREENWICH",
+ "HARINGEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Property Type=Semi-detached
% of Transactions=%{x}
Borough=%{y}",
+ "legendgroup": "Semi-detached",
+ "marker": {
+ "color": "#00cc96",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "Semi-detached",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "LjWcrKye0T8upKli/SEmQFnOwGnMjzlAjM2Cas/JAEBYbPTMn1oyQDq6rGNS3w5AJq5jQlNC+j/MnSiC7dQsQMX8cJryYTlA2cUtIq4d5z8KIrMnt9k1QJv7Y11zfwdA80ACkyWXJUD69oz4WxoyQBEPQcsc/0BA08AL4I7TMUDCuU2bCK0TQL5gyfY1VjVAtubIxJrKIEAaf1jX0fQMQJSY/y5PBDJALojYfd/mNUCcOH2HReIvQEFxJohXKyRAs+bm0BuG9z/4yG1QpRX6PyppXDf/cjtAou6vx5gHE0DGlmtbtxZBQKL5Xt033TxAi/PtcuBJ+T9y2+ezM3MhQA==",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "TOWER HAMLETS",
+ "MERTON",
+ "BROMLEY",
+ "NEWHAM",
+ "REDBRIDGE",
+ "SOUTHWARK",
+ "HAMMERSMITH AND FULHAM",
+ "EALING",
+ "KINGSTON UPON THAMES",
+ "CITY OF WESTMINSTER",
+ "BARNET",
+ "CAMDEN",
+ "GREENWICH",
+ "RICHMOND UPON THAMES",
+ "HAVERING",
+ "ENFIELD",
+ "HARINGEY",
+ "HOUNSLOW",
+ "LEWISHAM",
+ "WANDSWORTH",
+ "CROYDON",
+ "SUTTON",
+ "BRENT",
+ "BARKING AND DAGENHAM",
+ "KENSINGTON AND CHELSEA",
+ "ISLINGTON",
+ "HARROW",
+ "LAMBETH",
+ "BEXLEY",
+ "HILLINGDON",
+ "HACKNEY",
+ "WALTHAM FOREST"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Property Type=Other
% of Transactions=%{x}
Borough=%{y}",
+ "legendgroup": "Other",
+ "marker": {
+ "color": "#ab63fa",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "Other",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "YaKR5Lg1FkC3WtVZGFsWQChqYYhY4hRA+P2o6oqMF0Cd2RrkdesSQBTzgq0tcQ5AjYBTlBHwIkCRqz33Y6cTQGnnj5dYDAxA4qk5TANBDkBqmdxG0C8NQHXxmyKbgBRANDIWbuKgFEAiWVb+29YJQDOKBhKMyxFAb8feD3sgE0DJmjgeg8w1QDFLKUMAVRRAhEV45GXTE0BS6dvcYJsSQMnXhR2LLylAXFAwJzIJHkC0cK8TsTcZQDj0VemThRZAEkumf7jYHUBZ34ot1lMXQHVflm4BixhArV64CPYvF0CpsCtXvvYSQOnBArloYyNAOsYBsQ73EUAu8nV/4I0SQAh/5z0ghhBA",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "HARROW",
+ "SOUTHWARK",
+ "RICHMOND UPON THAMES",
+ "EALING",
+ "LAMBETH",
+ "GREENWICH",
+ "CAMDEN",
+ "HILLINGDON",
+ "BEXLEY",
+ "BARKING AND DAGENHAM",
+ "SUTTON",
+ "CROYDON",
+ "BARNET",
+ "HAVERING",
+ "WANDSWORTH",
+ "KINGSTON UPON THAMES",
+ "CITY OF LONDON",
+ "ENFIELD",
+ "MERTON",
+ "REDBRIDGE",
+ "CITY OF WESTMINSTER",
+ "ISLINGTON",
+ "HACKNEY",
+ "HOUNSLOW",
+ "BRENT",
+ "HAMMERSMITH AND FULHAM",
+ "HARINGEY",
+ "NEWHAM",
+ "WALTHAM FOREST",
+ "KENSINGTON AND CHELSEA",
+ "LEWISHAM",
+ "TOWER HAMLETS",
+ "BROMLEY"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Property Type=Terraced
% of Transactions=%{x}
Borough=%{y}",
+ "legendgroup": "Terraced",
+ "marker": {
+ "color": "#FFA15A",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "Terraced",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "WeP+4kETQEAGRonA8uwyQG5aJbtqKEVAHJaC2HUvMkBg9gs6z5M4QJw6NSpxjT5AjkoYgROLNkACSGLpBAY5QD4wUNj41DNAwHpljXs2GkBozwQUV5swQE5RRsApiiVAdRtsycSGP0APsgoteWo8QOwKcjVJSERAx/m2L4XnOkAtC1QIO9UiQMcP8ivqMjRAtYUNcuGKPUBRSCOi/Jw8QDsUTyHTSEVAUFY9oRHQQkD2CmtCPWU3QBLyxjUmmzBAvPfTmUn/M0ApB0SGe5VMQOfn7XHKZS9Auc8il9PBP0DZLhvWhfvrPxgugv1LMkJA3PDzo5z6N0D8T3q9VtIyQLs/VyQePj5A",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "LEWISHAM",
+ "SOUTHWARK",
+ "WALTHAM FOREST",
+ "KENSINGTON AND CHELSEA",
+ "WANDSWORTH",
+ "HAVERING",
+ "HILLINGDON",
+ "HOUNSLOW",
+ "BRENT",
+ "TOWER HAMLETS",
+ "ISLINGTON",
+ "CAMDEN",
+ "HARINGEY",
+ "SUTTON",
+ "MERTON",
+ "EALING",
+ "CITY OF WESTMINSTER",
+ "KINGSTON UPON THAMES",
+ "GREENWICH",
+ "CROYDON",
+ "REDBRIDGE",
+ "ENFIELD",
+ "BROMLEY",
+ "BARNET",
+ "HARROW",
+ "BARKING AND DAGENHAM",
+ "HACKNEY",
+ "RICHMOND UPON THAMES",
+ "CITY OF LONDON",
+ "NEWHAM",
+ "HAMMERSMITH AND FULHAM",
+ "LAMBETH",
+ "BEXLEY"
+ ],
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "barmode": "stack",
+ "height": 900,
+ "legend": {
+ "title": {
+ "text": "Property Type"
+ },
+ "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": "Property Type Mix by Borough (2020+)"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "% of Transactions"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "categoryarray": [
+ "HAVERING",
+ "BEXLEY",
+ "BARKING AND DAGENHAM",
+ "REDBRIDGE",
+ "BROMLEY",
+ "HILLINGDON",
+ "ENFIELD",
+ "HARROW",
+ "SUTTON",
+ "CROYDON",
+ "RICHMOND UPON THAMES",
+ "MERTON",
+ "KINGSTON UPON THAMES",
+ "WALTHAM FOREST",
+ "HOUNSLOW",
+ "BARNET",
+ "EALING",
+ "LEWISHAM",
+ "BRENT",
+ "GREENWICH",
+ "NEWHAM",
+ "HARINGEY",
+ "WANDSWORTH",
+ "HAMMERSMITH AND FULHAM",
+ "KENSINGTON AND CHELSEA",
+ "SOUTHWARK",
+ "LAMBETH",
+ "ISLINGTON",
+ "CAMDEN",
+ "HACKNEY",
+ "CITY OF WESTMINSTER",
+ "CITY OF LONDON",
+ "TOWER HAMLETS"
+ ],
+ "categoryorder": "array",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Borough"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Property Type Mix by Borough\n",
+ "property_mix = (\n",
+ " lf.filter(LONDON_FILTER).filter(pl.col(\"date_of_transfer\").dt.year() >= 2020)\n",
+ " .group_by(\"district\", \"property_type\").agg(pl.len().alias(\"count\"))\n",
+ " .with_columns(pl.col(\"property_type\").replace(PROPERTY_TYPE_MAP).alias(\"type_name\")).collect()\n",
+ ")\n",
+ "totals = property_mix.group_by(\"district\").agg(pl.col(\"count\").sum().alias(\"total\"))\n",
+ "property_mix_pct = property_mix.join(totals, on=\"district\").with_columns((pl.col(\"count\") / pl.col(\"total\") * 100).alias(\"percentage\"))\n",
+ "flat_pct = property_mix_pct.filter(pl.col(\"property_type\") == \"F\").sort(\"percentage\", descending=True)\n",
+ "\n",
+ "fig = px.bar(property_mix_pct.to_pandas(), x=\"percentage\", y=\"district\", color=\"type_name\", orientation=\"h\",\n",
+ " title=\"Property Type Mix by Borough (2020+)\",\n",
+ " labels={\"percentage\": \"% of Transactions\", \"district\": \"Borough\", \"type_name\": \"Property Type\"},\n",
+ " category_orders={\"district\": flat_pct[\"district\"].to_list()})\n",
+ "fig.update_layout(height=900, barmode=\"stack\", legend_title=\"Property Type\")\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "Tenure=Freehold
% of Transactions=%{x}
Borough=%{y}",
+ "legendgroup": "Freehold",
+ "marker": {
+ "color": "seagreen",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "Freehold",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "6dnJd5tDT0Dz7H5+F1RNQN2Uw7IzV0RAbfovygqYM0A/QWT25DZIQKl4gJ6jBU5AtuLdOcrsRUAyl2QdG4lKQJyPwfkYnElA5bSirLdtPkAP4AhOSg5TQMZ7d+F54jlAKQn8iqDbUEBcob3z7BRNQMtPxHj4QS5AJ01O6CgxREC5d/vS+0VQQCoUsrYRVFFAH3t+qdycI0CSwx5EcvgzQMIvk4Yq10xAi/bzB62tUEAXed2ZnWFOQGdCDK+dTTpAEK3zVk5OR0BXNZfOo8lFQDL7ywPGFVJAQ8Ijqvs9RUBYQxjDfgA2QOr4n0wvzjhA2Fk7h2aZTUCM+vLsPo08QDod43w92h9A",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "ENFIELD",
+ "RICHMOND UPON THAMES",
+ "NEWHAM",
+ "HACKNEY",
+ "BARNET",
+ "CROYDON",
+ "LEWISHAM",
+ "WALTHAM FOREST",
+ "HOUNSLOW",
+ "WANDSWORTH",
+ "HAVERING",
+ "SOUTHWARK",
+ "REDBRIDGE",
+ "KINGSTON UPON THAMES",
+ "CITY OF WESTMINSTER",
+ "HARINGEY",
+ "HILLINGDON",
+ "BARKING AND DAGENHAM",
+ "CITY OF LONDON",
+ "CAMDEN",
+ "MERTON",
+ "BROMLEY",
+ "SUTTON",
+ "LAMBETH",
+ "EALING",
+ "GREENWICH",
+ "BEXLEY",
+ "BRENT",
+ "ISLINGTON",
+ "KENSINGTON AND CHELSEA",
+ "HARROW",
+ "HAMMERSMITH AND FULHAM",
+ "TOWER HAMLETS"
+ ],
+ "yaxis": "y"
+ },
+ {
+ "hovertemplate": "Tenure=Leasehold
% of Transactions=%{x}
Borough=%{y}",
+ "legendgroup": "Leasehold",
+ "marker": {
+ "color": "coral",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "Leasehold",
+ "orientation": "h",
+ "showlegend": true,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "DROBgeirREBkcD4G52NIQKrKaDFcNkxAKu85T+B/U0A3E9Dw56g7QM5om+LkdkdAwn/cx9bGN0DBvpsJG8lJQMUB2Cx0zFJADiGih2GHUkCcMNBqZIxWQOoSGPClpEBAV4d/YVz6Q0C9PdxVBMJMQGfvPJSYbFJAZQF0Tf0ZVEAnpsR4mWZEQBtP+G7jAVRAru0H6r5IQEBYrzclua8+QF1Bw0Sw3FFAB3bn8MA3VUCNEAlaCHRBQNmysRfXzk1AIms8TcyoTUAYJjaIZLxCQMdS1xSSZFFApV5CDBPrREA+0Gx51ShFQCzOMShcAldA71IMqbGxSkDqhiJmYp5DQEkdIsY1E0xA",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "RICHMOND UPON THAMES",
+ "HOUNSLOW",
+ "GREENWICH",
+ "ISLINGTON",
+ "BEXLEY",
+ "WALTHAM FOREST",
+ "HAVERING",
+ "BARNET",
+ "KENSINGTON AND CHELSEA",
+ "SOUTHWARK",
+ "CITY OF LONDON",
+ "BROMLEY",
+ "CROYDON",
+ "BRENT",
+ "LAMBETH",
+ "HACKNEY",
+ "HARROW",
+ "CAMDEN",
+ "REDBRIDGE",
+ "BARKING AND DAGENHAM",
+ "HAMMERSMITH AND FULHAM",
+ "CITY OF WESTMINSTER",
+ "HILLINGDON",
+ "HARINGEY",
+ "NEWHAM",
+ "ENFIELD",
+ "WANDSWORTH",
+ "KINGSTON UPON THAMES",
+ "MERTON",
+ "TOWER HAMLETS",
+ "EALING",
+ "SUTTON",
+ "LEWISHAM"
+ ],
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "barmode": "stack",
+ "height": 900,
+ "legend": {
+ "title": {
+ "text": "Tenure"
+ },
+ "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": "Freehold vs Leasehold by Borough (2020+)"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "% of Transactions"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "categoryarray": [
+ "TOWER HAMLETS",
+ "CITY OF LONDON",
+ "CITY OF WESTMINSTER",
+ "HACKNEY",
+ "CAMDEN",
+ "ISLINGTON",
+ "KENSINGTON AND CHELSEA",
+ "SOUTHWARK",
+ "LAMBETH",
+ "HAMMERSMITH AND FULHAM",
+ "WANDSWORTH",
+ "HARINGEY",
+ "NEWHAM",
+ "BRENT",
+ "GREENWICH",
+ "LEWISHAM",
+ "EALING",
+ "BARNET",
+ "HOUNSLOW",
+ "WALTHAM FOREST",
+ "MERTON",
+ "KINGSTON UPON THAMES",
+ "RICHMOND UPON THAMES",
+ "HARROW",
+ "CROYDON",
+ "SUTTON",
+ "ENFIELD",
+ "HILLINGDON",
+ "BROMLEY",
+ "REDBRIDGE",
+ "BARKING AND DAGENHAM",
+ "BEXLEY",
+ "HAVERING"
+ ],
+ "categoryorder": "array",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Borough"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Freehold vs Leasehold by Borough\n",
+ "tenure_mix = (\n",
+ " lf.filter(LONDON_FILTER).filter(pl.col(\"date_of_transfer\").dt.year() >= 2020)\n",
+ " .group_by(\"district\", \"duration\").agg(pl.len().alias(\"count\"))\n",
+ " .with_columns(pl.col(\"duration\").replace(TENURE_MAP).alias(\"tenure_name\")).collect()\n",
+ ")\n",
+ "totals_tenure = tenure_mix.group_by(\"district\").agg(pl.col(\"count\").sum().alias(\"total\"))\n",
+ "tenure_mix_pct = tenure_mix.join(totals_tenure, on=\"district\").with_columns((pl.col(\"count\") / pl.col(\"total\") * 100).alias(\"percentage\"))\n",
+ "freehold_pct = tenure_mix_pct.filter(pl.col(\"duration\") == \"F\").sort(\"percentage\", descending=True)\n",
+ "\n",
+ "fig = px.bar(tenure_mix_pct.to_pandas(), x=\"percentage\", y=\"district\", color=\"tenure_name\", orientation=\"h\",\n",
+ " title=\"Freehold vs Leasehold by Borough (2020+)\",\n",
+ " labels={\"percentage\": \"% of Transactions\", \"district\": \"Borough\", \"tenure_name\": \"Tenure\"},\n",
+ " category_orders={\"district\": freehold_pct[\"district\"].to_list()},\n",
+ " color_discrete_map={\"Freehold\": \"seagreen\", \"Leasehold\": \"coral\"})\n",
+ "fig.update_layout(height=900, barmode=\"stack\")\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "Volume Change (%)=%{marker.color}
Borough=%{y}",
+ "legendgroup": "",
+ "marker": {
+ "color": {
+ "bdata": "cQb1Fbzbp0GEsnCfyHikQTEMw/9EUaRBmCX+eCqmoUEfuPUkN/6gQVsGifOx8qBBa3oh9+OnoEHD4EYQOhafQTTEH8fW5Z1BXAPXMOncnUGi6An3CZSdQQ1bRn2qj51BoTUxU1Klm0EUL4RDWzabQf43AfYwFZtBFYvFcmvgmkELfLgBsVCZQT4tLJLvr5dBQR67rGB1lUGM51GynGiTQSu4tkfMSJNBXzwQDrtkNUC1gJIWUNIyQG7dBN58QipALArn/XO+KEDBimszAhYkQAXuvuPiZSNAISEhISEhIUCXA4y2Kz4VQDuIdTWfeRNA3SdzvglVAEAKnG7PilX/P8AiSsAiSvA/",
+ "dtype": "f8"
+ },
+ "coloraxis": "coloraxis",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "",
+ "orientation": "h",
+ "showlegend": false,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "cQb1Fbzbp0GEsnCfyHikQTEMw/9EUaRBmCX+eCqmoUEfuPUkN/6gQVsGifOx8qBBa3oh9+OnoEHD4EYQOhafQTTEH8fW5Z1BXAPXMOncnUGi6An3CZSdQQ1bRn2qj51BoTUxU1Klm0EUL4RDWzabQf43AfYwFZtBFYvFcmvgmkELfLgBsVCZQT4tLJLvr5dBQR67rGB1lUGM51GynGiTQSu4tkfMSJNBXzwQDrtkNUC1gJIWUNIyQG7dBN58QipALArn/XO+KEDBimszAhYkQAXuvuPiZSNAISEhISEhIUCXA4y2Kz4VQDuIdTWfeRNA3SdzvglVAEAKnG7PilX/P8AiSsAiSvA/",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "BARKING AND DAGENHAM",
+ "BRENT",
+ "KINGSTON UPON THAMES",
+ "SUTTON",
+ "REDBRIDGE",
+ "HARROW",
+ "HACKNEY",
+ "ENFIELD",
+ "BEXLEY",
+ "CITY OF WESTMINSTER",
+ "WALTHAM FOREST",
+ "NEWHAM",
+ "LEWISHAM",
+ "HAVERING",
+ "HILLINGDON",
+ "SOUTHWARK",
+ "GREENWICH",
+ "TOWER HAMLETS",
+ "BARNET",
+ "BROMLEY",
+ "CROYDON",
+ "CAMDEN",
+ "ISLINGTON",
+ "EALING",
+ "HAMMERSMITH AND FULHAM",
+ "HARINGEY",
+ "CITY OF LONDON",
+ "KENSINGTON AND CHELSEA",
+ "WANDSWORTH",
+ "MERTON",
+ "RICHMOND UPON THAMES",
+ "LAMBETH",
+ "HOUNSLOW"
+ ],
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "barmode": "relative",
+ "coloraxis": {
+ "colorbar": {
+ "title": {
+ "text": "Volume Change (%)"
+ }
+ },
+ "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": 800,
+ "legend": {
+ "tracegroupgap": 0
+ },
+ "shapes": [
+ {
+ "line": {
+ "color": "black",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 0,
+ "x1": 0,
+ "xref": "x",
+ "y0": 0,
+ "y1": 1,
+ "yref": "y domain"
+ }
+ ],
+ "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": "Market Activity Change: 2024 vs 2019 Transaction Volume (%)"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Volume Change (%)"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "categoryorder": "total ascending",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Borough"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Market Activity Change (2024 vs 2019)\n",
+ "volume_trend = (\n",
+ " lf.filter(LONDON_FILTER).with_columns(pl.col(\"date_of_transfer\").dt.year().alias(\"year\"))\n",
+ " .filter(pl.col(\"year\") >= 2019).group_by(\"district\", \"year\").agg(pl.len().alias(\"count\")).collect()\n",
+ ")\n",
+ "volume_2019 = volume_trend.filter(pl.col(\"year\") == 2019).select(\"district\", pl.col(\"count\").alias(\"count_2019\"))\n",
+ "volume_2024 = volume_trend.filter(pl.col(\"year\") == 2024).select(\"district\", pl.col(\"count\").alias(\"count_2024\"))\n",
+ "volume_change = volume_2019.join(volume_2024, on=\"district\", how=\"inner\").with_columns(\n",
+ " ((pl.col(\"count_2024\") - pl.col(\"count_2019\")) / pl.col(\"count_2019\") * 100).alias(\"pct_change\")\n",
+ ").sort(\"pct_change\", descending=True)\n",
+ "\n",
+ "fig = px.bar(volume_change.to_pandas(), x=\"pct_change\", y=\"district\", orientation=\"h\",\n",
+ " title=\"Market Activity Change: 2024 vs 2019 Transaction Volume (%)\",\n",
+ " color=\"pct_change\", color_continuous_scale=\"RdYlGn\",\n",
+ " labels={\"pct_change\": \"Volume Change (%)\", \"district\": \"Borough\"})\n",
+ "fig.add_vline(x=0, line_dash=\"dash\", line_color=\"black\")\n",
+ "fig.update_layout(yaxis={\"categoryorder\": \"total ascending\"}, height=800)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "New Build %=%{marker.color}
Borough=%{y}",
+ "legendgroup": "",
+ "marker": {
+ "color": {
+ "bdata": "CaTTMc7XQUA8TcyoYyA3QChLqhdsXDZAt1aFd41bMkC7xr4PBRovQHc9U6Wtby1Ac7BbVd5TK0Dp3+LgbtcqQJ/ixQVKMipAXxHkJeGtKEDEX12ng3InQLJyaWhZ4SZAGJazZlanJkADZaQkvoAkQH2R+Irm+SNAnjJKZYkSIkBk8oZKGtchQMzpb407yCFAzFaJi9kqIUBCoA1N4wkgQKtLK3aFYBpATjxCXU3LGEBgtoolK70YQF6eCMBm+RdAzoFKCAqBFkDLcW8dX5sTQFhItjvU8RJAt7qEQp/pEkB5u0VBnMINQGCpNP0qCAZAylZYlTwiBUB1uBE+xngBQEGOLaboePw/",
+ "dtype": "f8"
+ },
+ "coloraxis": "coloraxis",
+ "pattern": {
+ "shape": ""
+ }
+ },
+ "name": "",
+ "orientation": "h",
+ "showlegend": false,
+ "textposition": "auto",
+ "type": "bar",
+ "x": {
+ "bdata": "CaTTMc7XQUA8TcyoYyA3QChLqhdsXDZAt1aFd41bMkC7xr4PBRovQHc9U6Wtby1Ac7BbVd5TK0Dp3+LgbtcqQJ/ixQVKMipAXxHkJeGtKEDEX12ng3InQLJyaWhZ4SZAGJazZlanJkADZaQkvoAkQH2R+Irm+SNAnjJKZYkSIkBk8oZKGtchQMzpb407yCFAzFaJi9kqIUBCoA1N4wkgQKtLK3aFYBpATjxCXU3LGEBgtoolK70YQF6eCMBm+RdAzoFKCAqBFkDLcW8dX5sTQFhItjvU8RJAt7qEQp/pEkB5u0VBnMINQGCpNP0qCAZAylZYlTwiBUB1uBE+xngBQEGOLaboePw/",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": [
+ "TOWER HAMLETS",
+ "NEWHAM",
+ "CITY OF LONDON",
+ "GREENWICH",
+ "HACKNEY",
+ "EALING",
+ "BARNET",
+ "BRENT",
+ "HAMMERSMITH AND FULHAM",
+ "WANDSWORTH",
+ "HARINGEY",
+ "CITY OF WESTMINSTER",
+ "BARKING AND DAGENHAM",
+ "ISLINGTON",
+ "HOUNSLOW",
+ "HILLINGDON",
+ "HARROW",
+ "SOUTHWARK",
+ "CAMDEN",
+ "LAMBETH",
+ "KINGSTON UPON THAMES",
+ "WALTHAM FOREST",
+ "BEXLEY",
+ "CROYDON",
+ "HAVERING",
+ "SUTTON",
+ "LEWISHAM",
+ "MERTON",
+ "ENFIELD",
+ "BROMLEY",
+ "KENSINGTON AND CHELSEA",
+ "REDBRIDGE",
+ "RICHMOND UPON THAMES"
+ ],
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "barmode": "relative",
+ "coloraxis": {
+ "colorbar": {
+ "title": {
+ "text": "New Build %"
+ }
+ },
+ "colorscale": [
+ [
+ 0,
+ "rgb(247,251,255)"
+ ],
+ [
+ 0.125,
+ "rgb(222,235,247)"
+ ],
+ [
+ 0.25,
+ "rgb(198,219,239)"
+ ],
+ [
+ 0.375,
+ "rgb(158,202,225)"
+ ],
+ [
+ 0.5,
+ "rgb(107,174,214)"
+ ],
+ [
+ 0.625,
+ "rgb(66,146,198)"
+ ],
+ [
+ 0.75,
+ "rgb(33,113,181)"
+ ],
+ [
+ 0.875,
+ "rgb(8,81,156)"
+ ],
+ [
+ 1,
+ "rgb(8,48,107)"
+ ]
+ ]
+ },
+ "height": 800,
+ "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": "New Build Share by Borough (2020+)"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "New Build %"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "categoryorder": "total ascending",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Borough"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# New Build Share by Borough\n",
+ "new_build_rate = (\n",
+ " lf.filter(LONDON_FILTER).filter(pl.col(\"date_of_transfer\").dt.year() >= 2020)\n",
+ " .group_by(\"district\", \"old_new\").agg(pl.len().alias(\"count\")).collect()\n",
+ ")\n",
+ "totals_nb = new_build_rate.group_by(\"district\").agg(pl.col(\"count\").sum().alias(\"total\"))\n",
+ "new_build_pct = new_build_rate.filter(pl.col(\"old_new\") == \"Y\").join(totals_nb, on=\"district\").with_columns(\n",
+ " (pl.col(\"count\") / pl.col(\"total\") * 100).alias(\"new_build_pct\")\n",
+ ").sort(\"new_build_pct\", descending=True)\n",
+ "\n",
+ "fig = px.bar(new_build_pct.to_pandas(), x=\"new_build_pct\", y=\"district\", orientation=\"h\",\n",
+ " title=\"New Build Share by Borough (2020+)\", color=\"new_build_pct\", color_continuous_scale=\"Blues\",\n",
+ " labels={\"new_build_pct\": \"New Build %\", \"district\": \"Borough\"})\n",
+ "fig.update_layout(yaxis={\"categoryorder\": \"total ascending\"}, height=800)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "marker": {
+ "color": "lightgreen"
+ },
+ "name": "25th percentile",
+ "orientation": "h",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAOTTEUEAAAAAIOIRQQAAAADA6xJBAAAAAIDAFEEAAAAAgMAUQQAAAADgvBJBAAAAAGByFEEAAAAAwFwVQQAAAACAwBRBAAAAAIDAFEEAAAAAYHIUQQAAAACAwBRBAAAAAGDjFkEAAAAA4KoVQQAAAACgDhVBAAAAAIAxF0EAAAAA4CEXQQAAAAAAcBdBAAAAAOCqFUEAAAAA8EIYQQAAAADgGxhBAAAAAIAxF0EAAAAAAGoYQQAAAAAAahhBAAAAAMA+GkEAAAAAQHcbQQAAAADg/RxBAAAAAKBhHEEAAAAAgIQeQQAAAADgbh9BAAAAANASI0EAAAAAMIwhQQAAAABAJCRB",
+ "dtype": "f8"
+ },
+ "y": [
+ "BARKING AND DAGENHAM",
+ "CROYDON",
+ "BEXLEY",
+ "HAVERING",
+ "NEWHAM",
+ "SUTTON",
+ "ENFIELD",
+ "GREENWICH",
+ "LEWISHAM",
+ "HOUNSLOW",
+ "REDBRIDGE",
+ "HILLINGDON",
+ "TOWER HAMLETS",
+ "BROMLEY",
+ "HARROW",
+ "WALTHAM FOREST",
+ "EALING",
+ "MERTON",
+ "BRENT",
+ "LAMBETH",
+ "KINGSTON UPON THAMES",
+ "BARNET",
+ "HARINGEY",
+ "SOUTHWARK",
+ "HACKNEY",
+ "WANDSWORTH",
+ "ISLINGTON",
+ "RICHMOND UPON THAMES",
+ "HAMMERSMITH AND FULHAM",
+ "CAMDEN",
+ "CITY OF LONDON",
+ "CITY OF WESTMINSTER",
+ "KENSINGTON AND CHELSEA"
+ ]
+ },
+ {
+ "base": [
+ 292089,
+ 293000,
+ 310000,
+ 340000,
+ 340000,
+ 307000,
+ 335000,
+ 350000,
+ 340000,
+ 340000,
+ 335000,
+ 340000,
+ 375000,
+ 355000,
+ 345000,
+ 380000,
+ 379000,
+ 384000,
+ 355000,
+ 397500,
+ 395000,
+ 380000,
+ 400000,
+ 400000,
+ 430000,
+ 450000,
+ 475000,
+ 465000,
+ 500000,
+ 515000,
+ 625000,
+ 575000,
+ 660000
+ ],
+ "marker": {
+ "color": "steelblue"
+ },
+ "name": "Median",
+ "orientation": "h",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAHAF80AAAAAAgB/6QAAAAABABvlAAAAAAAD59UAAAAAAgDH3QAAAAABAPABBAAAAAADb+kAAAAAA2G/3QAAAAAAA2/pAAAAAAICE/kAAAAAAvJsBQQAAAAAAFwFBAAAAAADb+kAAAAAAABcBQQAAAAAAiANBAAAAAAC9/0AAAAAAgPv/QAAAAACA2ABBAAAAAIDABEEAAAAAoCwAQQAAAABQXQFBAAAAAACIA0EAAAAAABcBQQAAAABM8AFBAAAAAIBPAkEAAAAAgDEHQQAAAABAjwdBAAAAAEB3C0EAAAAAoCwQQQAAAACAhA5BAAAAACQjEEEAAAAAAGoYQQAAAAAAvR9B",
+ "dtype": "f8"
+ },
+ "y": [
+ "BARKING AND DAGENHAM",
+ "CROYDON",
+ "BEXLEY",
+ "HAVERING",
+ "NEWHAM",
+ "SUTTON",
+ "ENFIELD",
+ "GREENWICH",
+ "LEWISHAM",
+ "HOUNSLOW",
+ "REDBRIDGE",
+ "HILLINGDON",
+ "TOWER HAMLETS",
+ "BROMLEY",
+ "HARROW",
+ "WALTHAM FOREST",
+ "EALING",
+ "MERTON",
+ "BRENT",
+ "LAMBETH",
+ "KINGSTON UPON THAMES",
+ "BARNET",
+ "HARINGEY",
+ "SOUTHWARK",
+ "HACKNEY",
+ "WANDSWORTH",
+ "ISLINGTON",
+ "RICHMOND UPON THAMES",
+ "HAMMERSMITH AND FULHAM",
+ "CAMDEN",
+ "CITY OF LONDON",
+ "CITY OF WESTMINSTER",
+ "KENSINGTON AND CHELSEA"
+ ]
+ },
+ {
+ "base": [
+ 370000,
+ 400000,
+ 412500,
+ 430000,
+ 435000,
+ 440000,
+ 445000,
+ 445997.5,
+ 450000,
+ 465000,
+ 479247.5,
+ 480000,
+ 485000,
+ 495000,
+ 505000,
+ 510000,
+ 510000,
+ 522000,
+ 525000,
+ 530000,
+ 537250,
+ 540000,
+ 540000,
+ 546953.5,
+ 580000,
+ 640000,
+ 668000,
+ 690000,
+ 765000,
+ 765000,
+ 889393,
+ 975000,
+ 1180000
+ ],
+ "marker": {
+ "color": "coral"
+ },
+ "name": "75th percentile",
+ "orientation": "h",
+ "type": "bar",
+ "x": {
+ "bdata": "AAAAAADb6kAAAAAAAB0AQQAAAADAXPVAAAAAAIAx90AAAAAAAPn1QAAAAAAAiANBAAAAAEAkBEEAAAAAVDYBQQAAAADAXAVBAAAAAEAkBEEAAAAAxMoBQQAAAAAATP1AAAAAAIAxB0EAAAAAgDEHQQAAAADA6wJBAAAAAIBPAkEAAAAAQAYJQQAAAAAARg5BAAAAAMDNB0EAAAAAwD4KQQAAAACwBQ1BAAAAAAC9D0EAAAAAANsKQQAAAAAaDhBBAAAAAMAgD0EAAAAAgMAUQQAAAABgZhZBAAAAAKB/F0EAAAAAIJodQQAAAACwUyBBAAAAAB53JEEAAAAA2O0xQQAAAABQ2jFB",
+ "dtype": "f8"
+ },
+ "y": [
+ "BARKING AND DAGENHAM",
+ "CROYDON",
+ "BEXLEY",
+ "HAVERING",
+ "NEWHAM",
+ "SUTTON",
+ "ENFIELD",
+ "GREENWICH",
+ "LEWISHAM",
+ "HOUNSLOW",
+ "REDBRIDGE",
+ "HILLINGDON",
+ "TOWER HAMLETS",
+ "BROMLEY",
+ "HARROW",
+ "WALTHAM FOREST",
+ "EALING",
+ "MERTON",
+ "BRENT",
+ "LAMBETH",
+ "KINGSTON UPON THAMES",
+ "BARNET",
+ "HARINGEY",
+ "SOUTHWARK",
+ "HACKNEY",
+ "WANDSWORTH",
+ "ISLINGTON",
+ "RICHMOND UPON THAMES",
+ "HAMMERSMITH AND FULHAM",
+ "CAMDEN",
+ "CITY OF LONDON",
+ "CITY OF WESTMINSTER",
+ "KENSINGTON AND CHELSEA"
+ ]
+ }
+ ],
+ "layout": {
+ "annotations": [
+ {
+ "showarrow": false,
+ "text": "£300k",
+ "x": 300000,
+ "xanchor": "center",
+ "xref": "x",
+ "y": 1,
+ "yanchor": "bottom",
+ "yref": "y domain"
+ },
+ {
+ "showarrow": false,
+ "text": "£500k",
+ "x": 500000,
+ "xanchor": "center",
+ "xref": "x",
+ "y": 1,
+ "yanchor": "bottom",
+ "yref": "y domain"
+ },
+ {
+ "showarrow": false,
+ "text": "£750k",
+ "x": 750000,
+ "xanchor": "center",
+ "xref": "x",
+ "y": 1,
+ "yanchor": "bottom",
+ "yref": "y domain"
+ },
+ {
+ "showarrow": false,
+ "text": "£1000k",
+ "x": 1000000,
+ "xanchor": "center",
+ "xref": "x",
+ "y": 1,
+ "yanchor": "bottom",
+ "yref": "y domain"
+ }
+ ],
+ "barmode": "stack",
+ "height": 900,
+ "legend": {
+ "title": {
+ "text": "Price Point"
+ }
+ },
+ "shapes": [
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 300000,
+ "x1": 300000,
+ "xref": "x",
+ "y0": 0,
+ "y1": 1,
+ "yref": "y domain"
+ },
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 500000,
+ "x1": 500000,
+ "xref": "x",
+ "y0": 0,
+ "y1": 1,
+ "yref": "y domain"
+ },
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 750000,
+ "x1": 750000,
+ "xref": "x",
+ "y0": 0,
+ "y1": 1,
+ "yref": "y domain"
+ },
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 1000000,
+ "x1": 1000000,
+ "xref": "x",
+ "y0": 0,
+ "y1": 1,
+ "yref": "y domain"
+ }
+ ],
+ "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": "Borough Price Ranges (2023+) - Find Your Budget"
+ },
+ "xaxis": {
+ "title": {
+ "text": "Price (£)"
+ }
+ },
+ "yaxis": {
+ "categoryorder": "total ascending"
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Budget Finder: Borough Price Ranges\n",
+ "recent_prices = (\n",
+ " lf.filter(LONDON_FILTER).filter(pl.col(\"date_of_transfer\").dt.year() >= 2023)\n",
+ " .group_by(\"district\").agg(pl.col(\"price\").quantile(0.25).alias(\"p25\"), pl.col(\"price\").median().alias(\"median\"), pl.col(\"price\").quantile(0.75).alias(\"p75\"))\n",
+ " .sort(\"median\").collect()\n",
+ ")\n",
+ "\n",
+ "fig = go.Figure()\n",
+ "fig.add_trace(go.Bar(name=\"25th percentile\", y=recent_prices[\"district\"], x=recent_prices[\"p25\"], orientation=\"h\", marker_color=\"lightgreen\"))\n",
+ "fig.add_trace(go.Bar(name=\"Median\", y=recent_prices[\"district\"], x=recent_prices[\"median\"] - recent_prices[\"p25\"], orientation=\"h\", marker_color=\"steelblue\", base=recent_prices[\"p25\"]))\n",
+ "fig.add_trace(go.Bar(name=\"75th percentile\", y=recent_prices[\"district\"], x=recent_prices[\"p75\"] - recent_prices[\"median\"], orientation=\"h\", marker_color=\"coral\", base=recent_prices[\"median\"]))\n",
+ "\n",
+ "for budget in [300000, 500000, 750000, 1000000]:\n",
+ " fig.add_vline(x=budget, line_dash=\"dash\", line_color=\"gray\", annotation_text=f\"£{budget//1000}k\", annotation_position=\"top\")\n",
+ "\n",
+ "fig.update_layout(title=\"Borough Price Ranges (2023+) - Find Your Budget\", xaxis_title=\"Price (£)\",\n",
+ " yaxis={\"categoryorder\": \"total ascending\"}, barmode=\"stack\", height=900, legend_title=\"Price Point\")\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# Comprehensive Borough Comparison\n",
+ "comparison_data = (\n",
+ " recent_prices.select(\"district\", \"median\")\n",
+ " .join(growth_df.select(\"district\", \"cagr_5yr\"), on=\"district\", how=\"left\")\n",
+ " .join(freehold_pct.select(\"district\", \"percentage\").rename({\"percentage\": \"freehold_pct\"}), on=\"district\", how=\"left\")\n",
+ " .join(volume_change.select(\"district\", \"count_2024\"), on=\"district\", how=\"left\")\n",
+ " .join(new_build_pct.select(\"district\", \"new_build_pct\"), on=\"district\", how=\"left\")\n",
+ ")\n",
+ "\n",
+ "comparison_normalized = comparison_data.with_columns([\n",
+ " (100 - (pl.col(\"median\") - pl.col(\"median\").min()) / (pl.col(\"median\").max() - pl.col(\"median\").min()) * 100).alias(\"affordability_score\"),\n",
+ " ((pl.col(\"cagr_5yr\") - pl.col(\"cagr_5yr\").min()) / (pl.col(\"cagr_5yr\").max() - pl.col(\"cagr_5yr\").min()) * 100).alias(\"growth_score\"),\n",
+ " pl.col(\"freehold_pct\").alias(\"freehold_score\"),\n",
+ " ((pl.col(\"count_2024\") - pl.col(\"count_2024\").min()) / (pl.col(\"count_2024\").max() - pl.col(\"count_2024\").min()) * 100).alias(\"liquidity_score\"),\n",
+ " ((pl.col(\"new_build_pct\") - pl.col(\"new_build_pct\").min()) / (pl.col(\"new_build_pct\").max() - pl.col(\"new_build_pct\").min()) * 100).alias(\"development_score\"),\n",
+ "])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "coloraxis": "coloraxis",
+ "hovertemplate": "x: %{x}
y: %{y}
Score: %{z}",
+ "name": "0",
+ "type": "heatmap",
+ "x": [
+ "Affordability",
+ "5yr Growth",
+ "Freehold %",
+ "Liquidity",
+ "New Builds"
+ ],
+ "xaxis": "x",
+ "y": [
+ "BARKING AND DAGENHAM",
+ "CROYDON",
+ "BEXLEY",
+ "HAVERING",
+ "NEWHAM",
+ "SUTTON",
+ "ENFIELD",
+ "GREENWICH",
+ "LEWISHAM",
+ "HOUNSLOW",
+ "REDBRIDGE",
+ "HILLINGDON",
+ "TOWER HAMLETS",
+ "BROMLEY",
+ "HARROW",
+ "WALTHAM FOREST",
+ "EALING",
+ "MERTON",
+ "BRENT",
+ "LAMBETH",
+ "KINGSTON UPON THAMES",
+ "BARNET",
+ "HARINGEY",
+ "SOUTHWARK",
+ "HACKNEY",
+ "WANDSWORTH",
+ "ISLINGTON",
+ "RICHMOND UPON THAMES",
+ "HAMMERSMITH AND FULHAM",
+ "CAMDEN",
+ "CITY OF LONDON",
+ "CITY OF WESTMINSTER",
+ "KENSINGTON AND CHELSEA"
+ ],
+ "yaxis": "y",
+ "z": {
+ "bdata": "AAAAAAAAWUBeYyr+B+JVQCoUsrYRVFFA73seye3IOUCOxP1WZSg8QC+hvYT2ElhA+TNI8YQnSUCpeICeowVOQNSpS68WBVVAggikz1nbKECu+WGRMrBXQOE8TEudL1hAMvvLA8YVUkB8Hczk43hKQPG3yrYJ/ClAX0J7Ce0lV0AAAAAAAABZQA/gCE5KDlNA1w/1aVQnT0BSb16jWbAmQJEy8HRr/lZA4uA5Z1T+R0DdlMOyM1dEQBtlPiBWa0VAQlpTXrB6T0DEImXg6dZWQJhpn+iO/lZAF3ndmZ1hTkCih0TpscVFQE4fWk2naiJA9hLaS2ivVkDGkAt+npxVQOnZyXebQ09At9pvsO4zSkBXrRVReOQWQPjbFKOGp1ZA9vOXLdaFQkBXNZfOo8lFQDrifc8juU1AHm5aU2NySEApA0+35odWQM08s9HOx01AtuLdOcrsRUCBD/ZmXQxOQNTflHOjcCFAwdOt+WERVkCZJLJXNzxWQJyPwfkYnElA48OPB1fWRUCkdcCbnjU4QOKyEVTPoFVA3hAUDwz6VkApCfyKoNtQQGY8JkSh90VAJ5hLkOkV8z9YpAw83ZpVQA+p0hLyIlhAuXf70vtFUEA3NxE6LS9KQJGe10juZjVAi5SBp1tzVUDpp5M/SQ09QDod43w92h9A64vuWD7XTEAAAAAAAABZQPB0a35YJFVAgHYMEGPRUkCL9vMHra1QQPQAtFHmA1VAy5uaT/D9BkBWVVVVVdVUQOE3efdzrFVA2Fk7h2aZTUDp+nxkidFCQNTMYmdJDzVAiEXKwNOtVEAg2bFvbjZUQDKXZB0biUpAS/vEHn85S0Dwzx9N4RAqQIhFysDTrVRAepPFur8lUUAQrfNWTk5HQCF4ToJUuVBALmOE9HAUQ0CbHxYpA09UQK0E6zIlhFNAwi+ThirXTEBxrPoP0I9GQKZP20KJZCFAIBYpA083VEBCN9IyJ/hTQEPCI6r7PUVABPcar/InREDQYLChrSpBQFIGnm7ND1RASBG0Sq12NkBnQgyvnU06QLcmHsrq0VFAdWUjlihnMkBoL6G9hNZTQIoXenKgm1FAXKG98+wUTUAZSExkZfRBQG1y6DxvZixAuOaHRcrAU0DFJvxi5NxNQD9BZPbkNkhAUMYaixUtU0Be4tZgbYZBQLjmh0XKwFNAafUplFN2SkAnTU7oKDFEQLyD4jMbHEdA6GmzbgJUPUC3P8hQ2YlTQAEeYlHz5z9Axnt34XniOUBTl14tCgZPQA/optBb+TRATGgvob2EUkB+kmmzuIouQG36L8oKmDNARXsgw/+SR0ANJ4vcyk5EQKuqqqqqqlBAVD6k4B/gQ0DltKKst20+QAAAAAAAAFlAu8/wsA8lP0BYpAw83ZpPQAmgB5+4klFAWEMYw34ANkD5XHuyMf1GQKjzVMV2/DhASRl4ujU/TkC5PWtR9/tQQPPsfn4XVE1AlPx3c1xYSEAAAAAAAAAAADY/LFIGnklAGVAc+xBvTkCM+vLsPo08QO8zZNOFbkZASMtW8+mwQEA2PyxSBp5JQPkwP1ZS0EBAksMeRHL4M0ArOMWLEzNGQI6eeFlGETRAngrM4k7wQUAAAAAAAAAAAB97fqncnCNAAAAAAAAAAABMQuABtVlOQJwfFikDTzlAYDk6vqmsNEDLT8R4+EEuQBsge0WdA0xA780qTvF9PEAAAAAAAAAAAEgRtEqtdjZA6vifTC/OOECh+MwGx2FCQAVP//vNVwRA",
+ "dtype": "f8",
+ "shape": "33, 5"
+ }
+ }
+ ],
+ "layout": {
+ "coloraxis": {
+ "colorbar": {
+ "title": {
+ "text": "Score"
+ }
+ },
+ "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": 900,
+ "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": "Borough Scores Heatmap (Higher = Better)"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ]
+ },
+ "yaxis": {
+ "anchor": "x",
+ "autorange": "reversed",
+ "domain": [
+ 0,
+ 1
+ ]
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Borough Scores Heatmap\n",
+ "scores_only = comparison_normalized.select([\"district\", \"affordability_score\", \"growth_score\", \"freehold_score\", \"liquidity_score\", \"development_score\"]).drop_nulls().sort(\"affordability_score\", descending=True)\n",
+ "\n",
+ "fig = px.imshow(\n",
+ " scores_only.select([\"affordability_score\", \"growth_score\", \"freehold_score\", \"liquidity_score\", \"development_score\"]).to_pandas(),\n",
+ " y=scores_only[\"district\"].to_list(),\n",
+ " x=[\"Affordability\", \"5yr Growth\", \"Freehold %\", \"Liquidity\", \"New Builds\"],\n",
+ " color_continuous_scale=\"RdYlGn\", aspect=\"auto\",\n",
+ " title=\"Borough Scores Heatmap (Higher = Better)\", labels={\"color\": \"Score\"})\n",
+ "fig.update_layout(height=900)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.plotly.v1+json": {
+ "config": {
+ "plotlyServerURL": "https://plot.ly"
+ },
+ "data": [
+ {
+ "hovertemplate": "Affordability (higher=cheaper)=%{x}
5yr Growth (higher=faster)=%{y}
Liquidity=%{marker.size}
district=%{text}
Freehold %=%{marker.color}",
+ "legendgroup": "",
+ "marker": {
+ "color": {
+ "bdata": "KhSythFUUUCpeICeowVOQDL7ywPGFVJAD+AITkoOU0DdlMOyM1dEQBd53ZmdYU5A6dnJd5tDT0BXNZfOo8lFQLbi3TnK7EVAnI/B+RicSUApCfyKoNtQQLl3+9L7RVBAOh3jfD3aH0CL9vMHra1QQNhZO4dmmU1AMpdkHRuJSkAQrfNWTk5HQMIvk4Yq10xAQ8Ijqvs9RUBnQgyvnU06QFyhvfPsFE1AP0Fk9uQ2SEAnTU7oKDFEQMZ7d+F54jlAbfovygqYM0DltKKst20+QFhDGMN+ADZA8+x+fhdUTUCM+vLsPo08QJLDHkRy+DNAH3t+qdycI0DLT8R4+EEuQOr4n0wvzjhA",
+ "dtype": "f8"
+ },
+ "coloraxis": "coloraxis",
+ "size": {
+ "bdata": "73seye3IOUDUqUuvFgVVQHwdzOTjeEpA1w/1aVQnT0AbZT4gVmtFQKKHROmxxUVAt9pvsO4zSkA64n3PI7lNQIEP9mZdDE5A48OPB1fWRUBmPCZEofdFQDc3ETotL0pA64vuWD7XTED0ALRR5gNVQOn6fGSJ0UJAS/vEHn85S0AheE6CVLlQQHGs+g/Qj0ZABPcar/InREC3Jh7K6tFRQBlITGRl9EFAUMYaixUtU0C8g+IzGxxHQFOXXi0KBk9ARXsgw/+SR0AAAAAAAABZQPlce7Ix/UZAlPx3c1xYSEDvM2TThW5GQCs4xYsTM0ZAAAAAAAAAAAAbIHtFnQNMQKH4zAbHYUJA",
+ "dtype": "f8"
+ },
+ "sizemode": "area",
+ "sizeref": 0.25,
+ "symbol": "circle"
+ },
+ "mode": "markers+text",
+ "name": "",
+ "orientation": "v",
+ "showlegend": false,
+ "text": [
+ "BARKING AND DAGENHAM",
+ "CROYDON",
+ "BEXLEY",
+ "HAVERING",
+ "NEWHAM",
+ "SUTTON",
+ "ENFIELD",
+ "GREENWICH",
+ "LEWISHAM",
+ "HOUNSLOW",
+ "REDBRIDGE",
+ "HILLINGDON",
+ "TOWER HAMLETS",
+ "BROMLEY",
+ "HARROW",
+ "WALTHAM FOREST",
+ "EALING",
+ "MERTON",
+ "BRENT",
+ "LAMBETH",
+ "KINGSTON UPON THAMES",
+ "BARNET",
+ "HARINGEY",
+ "SOUTHWARK",
+ "HACKNEY",
+ "WANDSWORTH",
+ "ISLINGTON",
+ "RICHMOND UPON THAMES",
+ "HAMMERSMITH AND FULHAM",
+ "CAMDEN",
+ "CITY OF LONDON",
+ "CITY OF WESTMINSTER",
+ "KENSINGTON AND CHELSEA"
+ ],
+ "textfont": {
+ "size": 8
+ },
+ "textposition": "top center",
+ "type": "scatter",
+ "x": {
+ "bdata": "AAAAAAAAWUAvob2E9hJYQK75YZEysFdAX0J7Ce0lV0CRMvB0a/5WQMQiZeDp1lZA9hLaS2ivVkD42xSjhqdWQCkDT7fmh1ZAwdOt+WERVkDishFUz6BVQFikDDzdmlVAi5SBp1tzVUDwdGt+WCRVQFZVVVVV1VRAiEXKwNOtVECIRcrA061UQJsfFikDT1RAIBYpA083VEBSBp5uzQ9UQGgvob2E1lNAuOaHRcrAU0C45odFysBTQLc/yFDZiVNATGgvob2EUkCrqqqqqqpQQFikDDzdmk9ASRl4ujU/TkA2PyxSBp5JQDY/LFIGnklAngrM4k7wQUCcHxYpA085QAAAAAAAAAAA",
+ "dtype": "f8"
+ },
+ "xaxis": "x",
+ "y": {
+ "bdata": "XmMq/gfiVUD5M0jxhCdJQOE8TEudL1hAAAAAAAAAWUDi4DlnVP5HQJhpn+iO/lZAxpALfp6cVUD285ct1oVCQM08s9HOx01AmSSyVzc8VkDeEBQPDPpWQA+p0hLyIlhA6aeTP0kNPUCAdgwQY9FSQOE3efdzrFVAINmxb242VEB6k8W6vyVRQK0E6zIlhFNAQjfSMif4U0BIEbRKrXY2QIoXenKgm1FAxSb8YuTcTUBp9SmUU3ZKQAEeYlHz5z9AfpJps7iKLkBUPqTgH+BDQAmgB5+4klFAuT1rUff7UEAZUBz7EG9OQPkwP1ZS0EBAAAAAAAAAAABgOTq+qaw0QEgRtEqtdjZA",
+ "dtype": "f8"
+ },
+ "yaxis": "y"
+ }
+ ],
+ "layout": {
+ "annotations": [
+ {
+ "font": {
+ "size": 11
+ },
+ "showarrow": false,
+ "text": "Best Value
(Affordable+Growing)",
+ "x": 75,
+ "y": 85
+ },
+ {
+ "font": {
+ "size": 11
+ },
+ "showarrow": false,
+ "text": "Premium Growth
(Expensive+Growing)",
+ "x": 25,
+ "y": 85
+ },
+ {
+ "font": {
+ "size": 11
+ },
+ "showarrow": false,
+ "text": "Stable & Affordable
(Cheap+Steady)",
+ "x": 75,
+ "y": 15
+ },
+ {
+ "font": {
+ "size": 11
+ },
+ "showarrow": false,
+ "text": "Caution
(Expensive+Slow)",
+ "x": 25,
+ "y": 15
+ }
+ ],
+ "coloraxis": {
+ "colorbar": {
+ "title": {
+ "text": "Freehold %"
+ }
+ },
+ "colorscale": [
+ [
+ 0,
+ "#440154"
+ ],
+ [
+ 0.1111111111111111,
+ "#482878"
+ ],
+ [
+ 0.2222222222222222,
+ "#3e4989"
+ ],
+ [
+ 0.3333333333333333,
+ "#31688e"
+ ],
+ [
+ 0.4444444444444444,
+ "#26828e"
+ ],
+ [
+ 0.5555555555555556,
+ "#1f9e89"
+ ],
+ [
+ 0.6666666666666666,
+ "#35b779"
+ ],
+ [
+ 0.7777777777777778,
+ "#6ece58"
+ ],
+ [
+ 0.8888888888888888,
+ "#b5de2b"
+ ],
+ [
+ 1,
+ "#fde725"
+ ]
+ ]
+ },
+ "height": 700,
+ "legend": {
+ "itemsizing": "constant",
+ "tracegroupgap": 0
+ },
+ "shapes": [
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 0,
+ "x1": 1,
+ "xref": "x domain",
+ "y0": 67.93697009537472,
+ "y1": 67.93697009537472,
+ "yref": "y"
+ },
+ {
+ "line": {
+ "color": "gray",
+ "dash": "dash"
+ },
+ "type": "line",
+ "x0": 82.71604938271605,
+ "x1": 82.71604938271605,
+ "xref": "x",
+ "y0": 0,
+ "y1": 1,
+ "yref": "y domain"
+ }
+ ],
+ "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": "Value vs Growth Quadrant Analysis"
+ },
+ "xaxis": {
+ "anchor": "y",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "Affordability (higher=cheaper)"
+ }
+ },
+ "yaxis": {
+ "anchor": "x",
+ "domain": [
+ 0,
+ 1
+ ],
+ "title": {
+ "text": "5yr Growth (higher=faster)"
+ }
+ }
+ }
+ }
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Value vs Growth Quadrant\n",
+ "value_growth = comparison_normalized.drop_nulls()\n",
+ "median_afford = value_growth[\"affordability_score\"].median()\n",
+ "median_growth = value_growth[\"growth_score\"].median()\n",
+ "\n",
+ "fig = px.scatter(value_growth.to_pandas(), x=\"affordability_score\", y=\"growth_score\", text=\"district\",\n",
+ " size=\"liquidity_score\", color=\"freehold_score\", color_continuous_scale=\"Viridis\",\n",
+ " title=\"Value vs Growth Quadrant Analysis\",\n",
+ " labels={\"affordability_score\": \"Affordability (higher=cheaper)\", \"growth_score\": \"5yr Growth (higher=faster)\", \"liquidity_score\": \"Liquidity\", \"freehold_score\": \"Freehold %\"})\n",
+ "\n",
+ "fig.add_hline(y=median_growth, line_dash=\"dash\", line_color=\"gray\")\n",
+ "fig.add_vline(x=median_afford, line_dash=\"dash\", line_color=\"gray\")\n",
+ "fig.add_annotation(x=75, y=85, text=\"Best Value
(Affordable+Growing)\", showarrow=False, font=dict(size=11))\n",
+ "fig.add_annotation(x=25, y=85, text=\"Premium Growth
(Expensive+Growing)\", showarrow=False, font=dict(size=11))\n",
+ "fig.add_annotation(x=75, y=15, text=\"Stable & Affordable
(Cheap+Steady)\", showarrow=False, font=dict(size=11))\n",
+ "fig.add_annotation(x=25, y=15, text=\"Caution
(Expensive+Slow)\", showarrow=False, font=dict(size=11))\n",
+ "fig.update_traces(textposition=\"top center\", textfont_size=8)\n",
+ "fig.update_layout(height=700)\n",
+ "fig.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Top 15 Boroughs by Composite Score:\n",
+ "Weights: Affordability 30%, Growth 25%, Freehold 15%, Liquidity 15%, Development 15%\n",
+ "================================================================================\n"
+ ]
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "
shape: (15, 6)| rank | district | median_price_2023 | cagr_5yr | freehold_pct | composite_score |
|---|
| u32 | str | f64 | f64 | f64 | f64 |
| 1 | "HAVERING" | 430000.0 | 3.617519 | 76.223285 | 75.259025 |
| 2 | "BEXLEY" | 412500.0 | 3.465607 | 72.340211 | 73.353459 |
| 3 | "HILLINGDON" | 480000.0 | 3.456372 | 65.093495 | 70.892053 |
| 4 | "BARKING AND DAGENHAM" | 370000.0 | 3.035803 | 69.313581 | 70.371373 |
| 5 | "SUTTON" | 440000.0 | 3.243222 | 60.762622 | 67.429089 |
| 6 | "BROMLEY" | 495000.0 | 2.463801 | 66.713686 | 67.23558 |
| 7 | "ENFIELD" | 445000.0 | 2.985202 | 62.528182 | 66.932568 |
| 8 | "HOUNSLOW" | 465000.0 | 3.101548 | 51.219512 | 66.582225 |
| 9 | "REDBRIDGE" | 479247.5 | 3.239934 | 67.431674 | 65.814413 |
| 10 | "CROYDON" | 400000.0 | 1.299137 | 60.044056 | 64.948873 |
| 11 | "EALING" | 510000.0 | 2.152054 | 46.611766 | 64.712359 |
| 12 | "HARROW" | 505000.0 | 2.996745 | 59.198441 | 64.357919 |
| 13 | "WALTHAM FOREST" | 510000.0 | 2.724085 | 53.07114 | 63.110433 |
| 14 | "BARNET" | 540000.0 | 1.738493 | 48.428862 | 62.662661 |
| 15 | "BRENT" | 525000.0 | 2.678684 | 42.484243 | 61.798071 |
"
+ ],
+ "text/plain": [
+ "shape: (15, 6)\n",
+ "┌──────┬──────────────────────┬───────────────────┬──────────┬──────────────┬─────────────────┐\n",
+ "│ rank ┆ district ┆ median_price_2023 ┆ cagr_5yr ┆ freehold_pct ┆ composite_score │\n",
+ "│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n",
+ "│ u32 ┆ str ┆ f64 ┆ f64 ┆ f64 ┆ f64 │\n",
+ "╞══════╪══════════════════════╪═══════════════════╪══════════╪══════════════╪═════════════════╡\n",
+ "│ 1 ┆ HAVERING ┆ 430000.0 ┆ 3.617519 ┆ 76.223285 ┆ 75.259025 │\n",
+ "│ 2 ┆ BEXLEY ┆ 412500.0 ┆ 3.465607 ┆ 72.340211 ┆ 73.353459 │\n",
+ "│ 3 ┆ HILLINGDON ┆ 480000.0 ┆ 3.456372 ┆ 65.093495 ┆ 70.892053 │\n",
+ "│ 4 ┆ BARKING AND DAGENHAM ┆ 370000.0 ┆ 3.035803 ┆ 69.313581 ┆ 70.371373 │\n",
+ "│ 5 ┆ SUTTON ┆ 440000.0 ┆ 3.243222 ┆ 60.762622 ┆ 67.429089 │\n",
+ "│ 6 ┆ BROMLEY ┆ 495000.0 ┆ 2.463801 ┆ 66.713686 ┆ 67.23558 │\n",
+ "│ 7 ┆ ENFIELD ┆ 445000.0 ┆ 2.985202 ┆ 62.528182 ┆ 66.932568 │\n",
+ "│ 8 ┆ HOUNSLOW ┆ 465000.0 ┆ 3.101548 ┆ 51.219512 ┆ 66.582225 │\n",
+ "│ 9 ┆ REDBRIDGE ┆ 479247.5 ┆ 3.239934 ┆ 67.431674 ┆ 65.814413 │\n",
+ "│ 10 ┆ CROYDON ┆ 400000.0 ┆ 1.299137 ┆ 60.044056 ┆ 64.948873 │\n",
+ "│ 11 ┆ EALING ┆ 510000.0 ┆ 2.152054 ┆ 46.611766 ┆ 64.712359 │\n",
+ "│ 12 ┆ HARROW ┆ 505000.0 ┆ 2.996745 ┆ 59.198441 ┆ 64.357919 │\n",
+ "│ 13 ┆ WALTHAM FOREST ┆ 510000.0 ┆ 2.724085 ┆ 53.07114 ┆ 63.110433 │\n",
+ "│ 14 ┆ BARNET ┆ 540000.0 ┆ 1.738493 ┆ 48.428862 ┆ 62.662661 │\n",
+ "│ 15 ┆ BRENT ┆ 525000.0 ┆ 2.678684 ┆ 42.484243 ┆ 61.798071 │\n",
+ "└──────┴──────────────────────┴───────────────────┴──────────┴──────────────┴─────────────────┘"
+ ]
+ },
+ "execution_count": 32,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Borough Rankings with Composite Score\n",
+ "WEIGHTS = {\"affordability\": 0.30, \"growth\": 0.25, \"freehold\": 0.15, \"liquidity\": 0.15, \"development\": 0.15}\n",
+ "\n",
+ "ranking = (\n",
+ " comparison_normalized.drop_nulls()\n",
+ " .with_columns(\n",
+ " (pl.col(\"affordability_score\") * WEIGHTS[\"affordability\"] +\n",
+ " pl.col(\"growth_score\") * WEIGHTS[\"growth\"] +\n",
+ " pl.col(\"freehold_score\") * WEIGHTS[\"freehold\"] +\n",
+ " pl.col(\"liquidity_score\") * WEIGHTS[\"liquidity\"] +\n",
+ " pl.col(\"development_score\") * WEIGHTS[\"development\"]).alias(\"composite_score\")\n",
+ " )\n",
+ " .select([\"district\", pl.col(\"median\").alias(\"median_price_2023\"), \"cagr_5yr\", \"freehold_pct\", \"composite_score\"])\n",
+ " .sort(\"composite_score\", descending=True)\n",
+ " .with_row_index(\"rank\", offset=1)\n",
+ ")\n",
+ "\n",
+ "print(\"Top 15 Boroughs by Composite Score:\")\n",
+ "print(\"Weights: Affordability 30%, Growth 25%, Freehold 15%, Liquidity 15%, Development 15%\")\n",
+ "print(\"=\"*80)\n",
+ "ranking.head(15)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": ".venv",
+ "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.12.12"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}