|
109 | 109 | " \"gov.hmrc.income_tax.rates.uk[1].threshold\": 50_000,\n", |
110 | 110 | " \"gov.hmrc.income_tax.allowances.marriage_allowance.max\": 0.25,\n", |
111 | 111 | " \"gov.dwp.universal_credit.elements.child.limit.child_count\": 90,\n", |
112 | | - " }\n", |
| 112 | + " },\n", |
113 | 113 | ")" |
114 | 114 | ] |
115 | 115 | }, |
|
163 | 163 | "fig = px.bar(\n", |
164 | 164 | " y=result.decile.relative,\n", |
165 | 165 | " text=[f\"{x:.1%}\" for x in result.decile.relative.values()],\n", |
166 | | - " color_discrete_sequence=[BLUE]\n", |
| 166 | + " color_discrete_sequence=[BLUE],\n", |
167 | 167 | ").update_layout(\n", |
168 | 168 | " title=\"Impact of Reform UK tax-benefit policies by income decile\",\n", |
169 | 169 | " xaxis_title=\"Income decile\",\n", |
|
172 | 172 | " yaxis_tickformat=\".0%\",\n", |
173 | 173 | ")\n", |
174 | 174 | "\n", |
175 | | - "print(format_fig(fig).update_layout(\n", |
176 | | - ").to_json())" |
| 175 | + "print(format_fig(fig).update_layout().to_json())" |
177 | 176 | ] |
178 | 177 | }, |
179 | 178 | { |
|
323 | 322 | " print(reform, policy_reform_names[i])\n", |
324 | 323 | "\n", |
325 | 324 | " for year in tqdm(range(2025, 2030)):\n", |
326 | | - " debt_impact = sim.reform_simulation.calculate(\"gov_balance\", year).sum()/1e9 - sim.baseline_simulation.calculate(\"gov_balance\", year).sum()/1e9\n", |
| 325 | + " debt_impact = (\n", |
| 326 | + " sim.reform_simulation.calculate(\"gov_balance\", year).sum() / 1e9\n", |
| 327 | + " - sim.baseline_simulation.calculate(\"gov_balance\", year).sum()\n", |
| 328 | + " / 1e9\n", |
| 329 | + " )\n", |
327 | 330 | " years.append(year)\n", |
328 | 331 | " debt_impacts.append(debt_impact)\n", |
329 | | - " policies.append(policy_reform_names[i])\n", |
330 | | - "\n" |
| 332 | + " policies.append(policy_reform_names[i])" |
331 | 333 | ] |
332 | 334 | }, |
333 | 335 | { |
|
339 | 341 | "source": [ |
340 | 342 | "import pandas as pd\n", |
341 | 343 | "\n", |
342 | | - "df = pd.DataFrame({\n", |
343 | | - " \"Year\": years,\n", |
344 | | - " \"Debt impact (£ billions)\": debt_impacts,\n", |
345 | | - " \"Policy\": policies,\n", |
346 | | - "})\n", |
| 344 | + "df = pd.DataFrame(\n", |
| 345 | + " {\n", |
| 346 | + " \"Year\": years,\n", |
| 347 | + " \"Debt impact (£ billions)\": debt_impacts,\n", |
| 348 | + " \"Policy\": policies,\n", |
| 349 | + " }\n", |
| 350 | + ")\n", |
347 | 351 | "\n", |
348 | | - "df = df.pivot(columns=\"Year\", index=\"Policy\", values=\"Debt impact (£ billions)\")\n", |
| 352 | + "df = df.pivot(\n", |
| 353 | + " columns=\"Year\", index=\"Policy\", values=\"Debt impact (£ billions)\"\n", |
| 354 | + ")\n", |
349 | 355 | "df = df.iloc[[2, 1, 3, 0]]" |
350 | 356 | ] |
351 | 357 | }, |
|
0 commit comments