head() and tail() to Peek at the Triangle #286
Replies: 3 comments
-
We do have a |
Beta Was this translation helpful? Give feedback.
-
I mean something like this: cl.load_sample("raa").head()
cl.load_sample("raa").tail() This isn't a good example, but if we have a lot of origin years, the triangle display will quickly clog on the whole screen. |
Beta Was this translation helpful? Give feedback.
-
If you want modify dataframe displays globally, it will cascade to triangles: import pandas as pd
pd.set_option("display.max_rows", 10)
pd.set_option("display.max_columns", 10)
import chainladder as cl
tri = cl.load_sample('prism')['Paid']
tri.sum() As for explicit functionality, there is only a head/tail for the index axis: tri.head(5) # returns head of index only
tri.tail(5) # returns head of index only We do not currently have a named methods for head/tail for origin/development axes. I usually just iloc for this: tri.sum().iloc[..., -5:, :] # origin tail
tri.sum().iloc[..., -5:] # development tail If none of these feels great, then we could add an arg to head/tail to support an axis. Something like this: # This functionality currently doesn't exist
tri.sum().head(5, axis=2) # origin head
tri.sum().head(5, axis=3) # development head On this last one, we can even make the default axis be the first axis that has a length > 1, (similar to how |
Beta Was this translation helpful? Give feedback.
-
Sometimes the triangles are quite large, would it be helpful to have head() and tail() to peek at the top or bottom origin exposures?
Obviously this would only work for a 1D triangle. Not sure how to handle the columns (development) though.
Beta Was this translation helpful? Give feedback.
All reactions