Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 3 additions & 97 deletions docs/getting_started/tutorials/data-tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand Down Expand Up @@ -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": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>age</th>\n",
" <th>origin</th>\n",
" <th>values</th>\n",
" <th>valuation</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>12</td>\n",
" <td>1981-01-01</td>\n",
" <td>5012.0</td>\n",
" <td>1981</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>12</td>\n",
" <td>1982-01-01</td>\n",
" <td>106.0</td>\n",
" <td>1982</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>12</td>\n",
" <td>1983-01-01</td>\n",
" <td>3410.0</td>\n",
" <td>1983</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>12</td>\n",
" <td>1984-01-01</td>\n",
" <td>5655.0</td>\n",
" <td>1984</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>12</td>\n",
" <td>1985-01-01</td>\n",
" <td>1092.0</td>\n",
" <td>1985</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"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=`."
]
},
{
Expand Down Expand Up @@ -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)"
]
},
{
Expand Down
Loading