From 6ed2689e4cd6af297c6d3aa4a09003c4d83956df Mon Sep 17 00:00:00 2001 From: Simon Koch-Sultan Date: Tue, 17 Nov 2026 08:08:23 -0500 Subject: [PATCH] Build the data tutorial's triangle with age= instead of a valuation year MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tutorial built a valuation year with (origin.dt.year + age / 12 - 1).astype(int) before calling the Triangle constructor. That formula is right only when ages are whole years from annual origins, and since #1401 the constructor takes development ages directly. The section now passes age="age" and drops the valuation step. It also fixes "wide long format" to "long format". Fixes #1643 Developed with an AI assistant (Árbol, running Muse). --- .../tutorials/data-tutorial.ipynb | 100 +----------------- 1 file changed, 3 insertions(+), 97 deletions(-) diff --git a/docs/getting_started/tutorials/data-tutorial.ipynb b/docs/getting_started/tutorials/data-tutorial.ipynb index 4cca0ef78..5066941b5 100644 --- a/docs/getting_started/tutorials/data-tutorial.ipynb +++ b/docs/getting_started/tutorials/data-tutorial.ipynb @@ -287,7 +287,7 @@ "id": "1091eebb", "metadata": {}, "source": [ - "You can use pandas to unstack the data into the wide long format." + "You can use pandas to unstack the data into the long format." ] }, { @@ -510,99 +510,7 @@ "id": "80a93e5e", "metadata": {}, "source": [ - "Next, we will need a valuation column (think Schedule P style triangle)." - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "1554d334", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
ageoriginvaluesvaluation
0121981-01-015012.01981
1121982-01-01106.01982
2121983-01-013410.01983
3121984-01-015655.01984
4121985-01-011092.01985
\n", - "
" - ], - "text/plain": [ - " age origin values valuation\n", - "0 12 1981-01-01 5012.0 1981\n", - "1 12 1982-01-01 106.0 1982\n", - "2 12 1983-01-01 3410.0 1983\n", - "3 12 1984-01-01 5655.0 1984\n", - "4 12 1985-01-01 1092.0 1985" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df[\"valuation\"] = (df[\"origin\"].dt.year + df[\"age\"] / 12 - 1).astype(int)\n", - "df.head()" + "The `age` column holds development ages in months, so it can go straight to the `Triangle` constructor through `age=`. Data that records a valuation date for each cell instead would pass that column with `valuation=`." ] }, { @@ -792,9 +700,7 @@ } ], "source": [ - "cl.Triangle(\n", - " df, origin=\"origin\", valuation=\"valuation\", columns=\"values\", cumulative=True\n", - ")" + "cl.Triangle(df, origin=\"origin\", age=\"age\", columns=\"values\", cumulative=True)" ] }, {