{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%matplotlib notebook" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", ":mod:`fastlife` present values of net cashflows\n", "===============================================\n", "\"\"\"\n", "\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "sns.set()\n", "import modelx as mx\n", "\n", "proj = mx.read_model(\"model\").Projection\n", "pols = proj.Policy.PolicyData()\n", "\n", "\n", "for prod in [\"TERM\", \"WL\", \"ENDW\"]:\n", "\n", " fig, ax = plt.subplots()\n", " fig.suptitle('PV Net Cashflow by Issue Age')\n", " ax.set_title('Product: ' + prod)\n", " title = 'Product: ' + prod\n", " ax.set_xlabel('Issue Age')\n", " ax.set_ylabel('PV Net Cashflow')\n", "\n", " for sex, marker in zip([\"M\", \"F\"], [\"o\", \"^\"]):\n", " filter = (pols.Product == prod) & (\n", " pols.Sex == sex) & (pols.IssueAge < 60)\n", " ages = proj.Policy.IssueAge().loc[filter]\n", " pvcfs = proj.PV_NetCashflow(0).loc[filter]\n", " ax.scatter(ages, pvcfs, marker=marker)\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" } }, "nbformat": 4, "nbformat_minor": 2 }