chainladder-python
chainladder-python copied to clipboard
Instatiation bug
offending code:
import chainladder as cl
import pandas as pd
data = [['2010-01-01', '2011-06-30', 'premium', 100.0], ['2010-01-01', '2011-12-31', 'incurred', 100.0],
['2010-01-01', '2012-06-30', 'premium', 200.0], ['2010-01-01', '2012-12-31', 'incurred', 100.0],
['2010-01-01', '2013-12-31', 'incurred', 200.0], ['2011-01-01', '2011-06-30', 'premium', 100.0],
['2011-01-01', '2012-06-30', 'premium', 200.0], ['2011-01-01', '2012-12-31', 'incurred', 100.0],
['2011-01-01', '2013-12-31', 'incurred', 200.0], ['2012-01-01', '2012-06-30', 'premium', 200.0],
['2012-01-01', '2013-12-31', 'incurred', 200.0]]
df = pd.DataFrame(data, columns=['origin', 'val_date', 'idx', 'value'])
cl_tri = cl.Triangle(data=df, columns='value', origin='origin', development='val_date')
I'm not sure if this is related to this bug, but is triangle supposed to expand the whole triangle when instantiated?
This code does not give me a triangle, but if we comment out the the first line, the triangle will be complete. This is causing some problems.
data = [
# ["1998", "1998", 500000],
["1998", "2003", 500000],
["1999", "2003", 650000],
["2000", "2003", 800000],
["2001", "2003", 850000],
["2002", "2003", 975000],
["2003", "2003", 1000000],
]
df = pd.DataFrame(data, columns=["origin", "val_date", "value"])
cl_tri = cl.Triangle(
data=df, origin="origin", development="val_date", columns="value", cumulative=True
)
cl_tri
Hmm... I guess the triangle wouldn't know what grain to expand development to...
From the above, we can use .val_to_dev(), but the expanded triangle doesn't look right, the valuation dates are coded as each year's January instead of each year's December.