Skip to content

Commit

Permalink
update nb for multi-result reader
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowbean committed Aug 16, 2024
1 parent edaa794 commit c1e9066
Showing 1 changed file with 61 additions and 26 deletions.
87 changes: 61 additions & 26 deletions docs/source/nbsample/viewMultiResult.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@
},
{
"cell_type": "markdown",
"id": "4fed59e3",
"id": "75845521",
"metadata": {},
"source": [
"#### readFlowsByScenarios()"
"User need to import candy functions and `lens` to build paths which points to the data field of interest"
]
},
{
Expand All @@ -123,7 +123,19 @@
"metadata": {},
"outputs": [],
"source": [
"from absbox import readFlowsByScenarios,readMultiFlowsByScenarios,readFieldsByScenarios"
"from absbox import readFlowsByScenarios,readMultiFlowsByScenarios,readFieldsByScenarios\n",
"\n",
"from lenses import lens"
]
},
{
"cell_type": "markdown",
"id": "4fed59e3",
"metadata": {},
"source": [
"#### readFlowsByScenarios()\n",
"\n",
"The read single cashflow from multiple scenarios and build a dataframe"
]
},
{
Expand Down Expand Up @@ -208,8 +220,6 @@
}
],
"source": [
"from lenses import lens\n",
"\n",
"readFlowsByScenarios(rs1, lens['bonds']['A1']['balance']).head()"
]
},
Expand Down Expand Up @@ -390,7 +400,7 @@
"source": [
"#### readMultiFlowsByScenarios\n",
"\n",
"User can have option to view `multiple columns` from a multi result. And merge them into a multi-index dataframe"
"User can have option to view `multiple columns` from a multi result and merge them into a multi-index dataframe"
]
},
{
Expand Down Expand Up @@ -511,27 +521,36 @@
"#### readFieldsByScenarios"
]
},
{
"cell_type": "markdown",
"id": "3c125936",
"metadata": {},
"source": [
"| since `0.28.15`\n",
"\n",
"`readFieldsByScenarios` is more flexible candy function to view the fields from multiple results\n",
"\n",
"Here is the dataframe to be view"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6da78f21",
"metadata": {},
"outputs": [
{
"ename": "",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31mRunning cells with 'Python 3.12.3' requires the ipykernel package.\n",
"\u001b[1;31mRun the following command to install 'ipykernel' into the Python environment. \n",
"\u001b[1;31mCommand: '/opt/homebrew/bin/python3 -m pip install ipykernel -U --user --force-reinstall'"
]
}
],
"outputs": [],
"source": [
"rs2['CPR=1%']['pricing']['summary']"
]
},
{
"cell_type": "markdown",
"id": "21dea712",
"metadata": {},
"source": [
"view by `Index`"
]
},
{
"cell_type": "code",
"execution_count": 92,
Expand Down Expand Up @@ -617,6 +636,14 @@
"readFieldsByScenarios(rs2, lens['pricing']['summary'], \"A1\")"
]
},
{
"cell_type": "markdown",
"id": "592643c2",
"metadata": {},
"source": [
"view by `Column`"
]
},
{
"cell_type": "code",
"execution_count": 93,
Expand Down Expand Up @@ -678,6 +705,14 @@
"readFieldsByScenarios(rs2, lens['pricing']['summary'], \"pricing\", flip=True)"
]
},
{
"cell_type": "markdown",
"id": "c37dee5b",
"metadata": {},
"source": [
"view by `Column` ,which is a flow"
]
},
{
"cell_type": "code",
"execution_count": 94,
Expand Down Expand Up @@ -847,6 +882,14 @@
"readFieldsByScenarios(rs2, lens['pool']['flow'], 'Prepayment', flip=True)"
]
},
{
"cell_type": "markdown",
"id": "c8ddc995",
"metadata": {},
"source": [
"view by `Index` which is a flow"
]
},
{
"cell_type": "code",
"execution_count": 95,
Expand Down Expand Up @@ -991,14 +1034,6 @@
"source": [
"readFieldsByScenarios(rs2, lens['pool']['flow'], '2021-10-01')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "322f8971",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit c1e9066

Please sign in to comment.