.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated_examples\simplelife\plot_pvcashflows.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_examples_simplelife_plot_pvcashflows.py: simplelife: present values of cashflows ============================================= Present values of liability cashflows of a simple whole life policy. .. seealso:: * The :mod:`~simplelife` library .. GENERATED FROM PYTHON SOURCE LINES 10-36 .. image-sg:: /generated_examples/simplelife/images/sphx_glr_plot_pvcashflows_001.png :alt: plot pvcashflows :srcset: /generated_examples/simplelife/images/sphx_glr_plot_pvcashflows_001.png :class: sphx-glr-single-img .. code-block:: default import modelx as mx proj = mx.read_model("model").Projection vars = ['PV_PremIncome', 'PV_BenefitSurr', 'PV_BenefitDeath', 'PV_ExpsMaint', 'PV_ExpsCommTotal', 'PV_ExpsAcq'] polid = 171 for cells in vars: list(proj[polid].cells[cells](t) for t in range(50)) cfs = proj[polid].frame[vars].sort_index().dropna() [proj[polid].PV_NetCashflow[t] for t in range(50)] ncf = proj[polid].PV_NetCashflow.frame.sort_index() import seaborn as sns sns.set_theme(style="darkgrid") axes = ncf.plot.line(marker='o', color='r') cfs.plot(kind='bar', stacked=True, ax=axes) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.998 seconds) .. _sphx_glr_download_generated_examples_simplelife_plot_pvcashflows.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_pvcashflows.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_pvcashflows.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_