Running Present Value Example Ep.2#

This notebook runs and output results in tables. The result tables replicate figures shown in this tutorial video on Systemortph’s YouTube channel.

To run this notebook, the ifrs17 and present_value_ep2 modules in your copy of the ifrs17a library need to be importable. To ensure they are importable, make sure the current directory is set to your ifrs17a copy. Typically, the current directory is set to the location where you started this notebook, so it should run fine unless you have moved the notebook elsewhere. To check the current directory from Python, import os, and execute os.getcwd(). To change the current directory in Python, use the os.chdir function.

Click the badge below to run this notebook online on Google Colab. You need a Google account and need to be logged in to it to run this notebook on Google Colab. Run on Google Colab

The next code cell below is relevant only when you run this notebook on Google Colab. It installs lifelib and creates a copy of the library for this notebook.

import sys, os

if 'google.colab' in sys.modules:
    lib = 'ifrs17a'; lib_dir = '/content/'+ lib
    if not os.path.exists(lib_dir):
        !pip install lifelib
        import lifelib; lifelib.create(lib, lib_dir)

    %cd $lib_dir

Running is executed when it’s imported by the import statement. ifrsvars defined in the template module refers to a DataFrame that contains all the IFRS variables as rows.

import pandas as pd
from present_value_ep2 import ifrsvars as vars

The DataFrame below replicates figures in the table in the video, Systemorph #Techucation for IFRS17: Present Value with our Notebook

df = vars[(vars['EconomicBasis'] == 'L') & (vars['EstimateType'] == 'BE')].set_index(
    ['Novelty', 'AocType', 'AmountType'])['Value'].groupby(level=[0, 1, 2]).sum().unstack(level=2)
AmountType CL PR
Novelty AocType
C EOP 11459.723798 -14323.349204
N AU -770.405525 -1068.926528
BOP 11364.693439 -17128.546413
CF -240.320160 2210.550000
EV 916.777904 1913.390722
IA 188.978140 -249.816985