Running Present Value Example Ep.3#
This notebook runs present_value_ep3.py
and outputs results in tables. The result tables replicate figures shown in a video on Systemortph’s YouTube channel, Systemorph #Techucation for IFRS17: Adapt the Systemorph Notebook to your needs.
To run this notebook, the ifrs17
and present_value_ep3
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.
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 present_value_ep3.py
#
present_value_ep3.py
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.
[1]:
import pandas as pd
from present_value_ep3 import ifrsvars as vars
The video shows present values by repoting nodes in different tables. The table below replicates the figures for the reporting node G
for the period ending at the end of March 2021, which are shown around the 1:50 mark in the video.
[2]:
filter = ((vars['EconomicBasis']=='L') & (vars['EstimateType']=='BE')
& (vars['ReportingNode']=='G') & (vars['Year']==2021) & (vars['Month']==3))
df = vars[filter].set_index(['Novelty', 'AocType', 'AmountType'])['Value'].groupby(level=[0, 1, 2]).sum().unstack(level=2)
df
[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 |
The table below replicates the figures for the reporting node DE
for the period ending at the end of December 2021, which are shown around the 7:50 mark in the video.
[3]:
filter = ((vars['EconomicBasis']=='L') & (vars['EstimateType']=='BE')
& (vars['ReportingNode']=='DE') & (vars['Year']==2021) & (vars['Month']==12))
df = vars[filter].set_index(['Novelty', 'AocType', 'AmountType'])['Value'].groupby(level=[0, 1, 2]).sum().unstack(level=2)
df
[3]:
AmountType | CL | PR | |
---|---|---|---|
Novelty | AocType | ||
C | EOP | 7051.271474 | -6587.673594 |
N | AU | -470.146752 | -667.863724 |
BOP | 7102.933399 | -11801.034216 | |
CF | -614.620787 | 5237.597000 | |
EV | 564.101718 | 1219.303073 | |
IA | 469.003896 | -575.675728 |