Skip to content

Instantly share code, notes, and snippets.

PassengerId Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
1 0 3 Braund, Mr. Owen Harris male 22.0 1 0 A/5 21171 7.25 S
2 1 1 Cumings, Mrs. John Bradley (Florence Briggs Thayer) female 38.0 1 0 PC 17599 71.2833 C85 C
3 1 3 Heikkinen, Miss. Laina female 26.0 0 0 STON/O2. 3101282 7.925 S
4 1 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35.0 1 0 113803 53.1 C123 S
5 0 3 Allen, Mr. William Henry male 35.0 0 0 373450 8.05 S
6 0 3 Moran, Mr. James male 0 0 330877 8.4583 Q
7 0 1 McCarthy, Mr. Timothy J male 54.0 0 0 17463 51.8625 E46 S
8 0 3 Palsson, Master. Gosta Leonard male 2.0 3 1 349909 21.075 S
9 1 3 Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg) female 27.0 0 2 347742 11.1333 S
Year Interest rate Currency
1 0.03 EUR
2 0.031 EUR
3 0.032 EUR
4 0.033 EUR
1 0.020 GBP
2 0.021 GBP
3 0.022 GBP
4 0.023 GBP
Currency Country
GBP UK
EUR Italy
EUR France
EUR Belgium
EUR Germany
Client Insurance product Country Duration Price Payment year 1 Payment year 2 Payment year 3 Payment year 4
A Small car UK 1 200 0 50 30 0
B Small car Italy 1 100 0 0 0 80
C Small car UK 1 200 0 35 40 20
D Small car UK 1 220 0 40 60 0
E Small car France 1 200 0 20 30 50
F Businss car Belgium 1 450 0 100 100 100
G Businss car Germany 1 470 0 120 80 0
H Businss car UK 1 400 60 70 100 0
I Businss car UK 1 400 50 70 20 80
Client Insurance product Country Duration Price Payment year 1 Payment year 2 Payment year 3 Payment year 4
A Small car UK 1 200 0 50 30 0
Year Cash flows Currency Interest rate Discount factor
0 12000 USD 0.025 1.000
1 -2000 USD 0.025 0.976
2 -2000 USD 0.025 0.952
3 -2000 USD 0.025 0.929
4 -2000 USD 0.025 0.906
5 -2000 USD 0.025 0.884
# Groupby product and check the profitability
cf_with_rate_df = cf_with_rate_df.groupby("Product")[["Present value"]].sum().reset_index()