-
Notifications
You must be signed in to change notification settings - Fork 98
Support renaming of columns via mapping #660
Copy link
Copy link
Closed
Labels
Effort > Moderate 🐕Mid-sized tasks estimated to take a few days to a few weeks.Mid-sized tasks estimated to take a few days to a few weeks.Impact > Significant 💠High impact changes. Should only be done in response with community inputs.High impact changes. Should only be done in response with community inputs.
Metadata
Metadata
Assignees
Labels
Effort > Moderate 🐕Mid-sized tasks estimated to take a few days to a few weeks.Mid-sized tasks estimated to take a few days to a few weeks.Impact > Significant 💠High impact changes. Should only be done in response with community inputs.High impact changes. Should only be done in response with community inputs.
Description
Chainladder supports the renaming of columns, but in order to do so for multiple-column triangles, you'd have to pass a list of new column names of the same length as the list of old column names, and in the same order.
For triangles with lots of columns (let's say 10+), this becomes error prone and verbose, especially if you only want to rename one or two columns. The rest of the columns have to be in the same order, and of the same spelling.
pandas can rename DataFrame columns via a mapping dictionary, where you only need to specify the columns you want to rename:
Is your feature request aligned with the scope of the package?
Describe the solution you'd like, or your current workaround.
Consider a triangle with columns ['Paid Loss', 'Incurred Loss', 'Subrogation']. If we wanted to rename 'Incurred Loss' to 'Reported Loss', we should be able to do:
The current way to do this is more verbose, requiring the inclusion of 'Paid Loss' and 'Subrogation', even when they aren't being renamed. Mistyping or reordering these names will create semantic errors which will not be raised to the user:
Do you have any additional supporting notes?
No response