-
Hello, |
Beta Was this translation helpful? Give feedback.
Answered by
jbogaardt
Oct 13, 2021
Replies: 1 comment 1 reply
-
Hi @xne0n , Thanks for the question. It's not documented. We should probably mention something in the docs or figure out how to support wide. I'd use import chainladder as cl
# Suppose you have a wide triangle (perhaps copied from Excel clipboard...)
df = cl.load_sample('raa').to_frame()
# You can use pandas unstack to make wide format long
df = df.unstack().dropna().reset_index()
# make sure you have good column labels
df.columns = ['age', 'origin', 'values']
# and make a date-like valuation
df['valuation'] = (df['origin'].dt.year + df['age'] / 12 - 1).astype(int)
# Finally make a Triangle
cl.Triangle(df, origin='origin', development='valuation', columns='values') |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
xne0n
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @xne0n ,
Thanks for the question. It's not documented. We should probably mention something in the docs or figure out how to support wide. I'd use
pandas.unstack
to get there. Something like this: