import pandas as pdimport numpy as npimport plotly.express as px# --- generate random test data ---np.random.seed(42)regions = ["North East", "North West", "London", "South West", "Scotland", "Wales"]years =list(range(2010, 2026))rows = []for region in regions: base = np.random.uniform(4, 9) # starting affordability ratio drift = np.random.uniform(0.05, 0.3) # how fast it worsens over timefor year in years: noise = np.random.normal(0, 0.15) ratio = base + drift * (year -2010) + noise rows.append({"year": year, "region": region, "ratio": round(ratio, 2)})df = pd.DataFrame(rows)# --- interactive plotly chart ---fig = px.line( df, x="year", y="ratio", color="region", markers=True, title="House Price to Earnings Ratio by Region (test data)", labels={"ratio": "Price-to-Earnings Ratio", "year": "Year"},)fig.update_layout(hovermode="x unified")fig