casact / chainladder-python

Actuarial reserving in Python
https://chainladder-python.readthedocs.io/en/latest/
Mozilla Public License 2.0
192 stars 71 forks source link

[BUG] Bootstrap fail when len(key_label) > 1 #425

Open jbogaardt opened 1 year ago

jbogaardt commented 1 year ago

Describe the bug When the key_labels of a triangle are greater than length 1, the BootstrapODP puts the triangle in a bad state.

To Reproduce

import chainladder as cl
clrd = cl.load_sample('clrd')['CumPaidLoss'].sum()
resampled_triangles = cl.BootstrapODPSample().fit(clrd).resampled_triangles_
print(len(resampled_triangles.key_labels)) # [GRNAME, LOB] => length 2
resampled_triangles.index # Errors

Expected behavior We would either need to support key_label attributes of length 1 only or coerce the resampled triangles to some generic key_label like "iteration"