From 4a0678fbbf82e6367780a927aaac63143e467a24 Mon Sep 17 00:00:00 2001 From: Fridolin Glatter Date: Thu, 12 Dec 2024 14:33:06 +0100 Subject: [PATCH] Resolve further pandas FutureWarnings --- .../westeros_historical_new_capacity.ipynb | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tutorial/westeros/westeros_historical_new_capacity.ipynb b/tutorial/westeros/westeros_historical_new_capacity.ipynb index 0bce120ad..1fcfddd82 100644 --- a/tutorial/westeros/westeros_historical_new_capacity.ipynb +++ b/tutorial/westeros/westeros_historical_new_capacity.ipynb @@ -279,7 +279,7 @@ "# We will hence start by retrieving the demand in the `firstmodelyear`,\n", "# and assume this also applies for historic time-periods.\n", "demand_of_firstmodelyear = float(\n", - " scenario.par(\"demand\", filters={\"year\": scenario.firstmodelyear})[\"value\"]\n", + " scenario.par(\"demand\", filters={\"year\": scenario.firstmodelyear})[\"value\"].iloc[0]\n", ")\n", "print(f\"The demand of the `firstmodelyear` is {demand_of_firstmodelyear} GWa.\")" ] @@ -300,7 +300,7 @@ " \"year_act\": scenario.firstmodelyear,\n", " \"technology\": \"grid\",\n", " },\n", - " )[\"value\"]\n", + " )[\"value\"].iloc[0]\n", ")\n", "print(f\"Grid efficiency is {grid_eff}.\")\n", "demand_of_firstmodelyear /= grid_eff" @@ -313,7 +313,7 @@ "outputs": [], "source": [ "duration_period = float(\n", - " scenario.par(\"duration_period\", filters={\"year\": history})[\"value\"]\n", + " scenario.par(\"duration_period\", filters={\"year\": history})[\"value\"].iloc[0]\n", ")\n", "print(f\"The duration of the period is {duration_period} years.\")\n", "historical_new_capacity = demand_of_firstmodelyear / duration_period" @@ -844,12 +844,16 @@ "\n", "# Retrieve `\"historical_new_capacity\"`\n", "value = float(\n", - " scenario2.par(\"historical_new_capacity\", filters={\"technology\": \"coal_ppl\"}).value\n", + " scenario2.par(\n", + " \"historical_new_capacity\", filters={\"technology\": \"coal_ppl\"}\n", + " ).value.iloc[0]\n", ")\n", "\n", "# Retrieve `\"duration_period\"` for the year 700\n", "duration_period = float(\n", - " scenario.par(\"duration_period\", filters={\"year\": scenario.firstmodelyear})[\"value\"]\n", + " scenario.par(\"duration_period\", filters={\"year\": scenario.firstmodelyear})[\n", + " \"value\"\n", + " ].iloc[0]\n", ")\n", "\n", "value *= duration_period\n", @@ -976,12 +980,16 @@ "source": [ "# Retrieve `historical_new_capacity`\n", "value = float(\n", - " scenario2.par(\"historical_new_capacity\", filters={\"technology\": \"coal_ppl\"}).value\n", + " scenario2.par(\n", + " \"historical_new_capacity\", filters={\"technology\": \"coal_ppl\"}\n", + " ).value.iloc[0]\n", ")\n", "\n", "# Retrieve `duration_period` for the year 700\n", "duration_period = float(\n", - " scenario.par(\"duration_period\", filters={\"year\": scenario.firstmodelyear})[\"value\"]\n", + " scenario.par(\"duration_period\", filters={\"year\": scenario.firstmodelyear})[\n", + " \"value\"\n", + " ].iloc[0]\n", ")\n", "\n", "value *= duration_period\n",