Skip to content

Add some validation logic to TrianglePandas.rename #654

@genedan

Description

@genedan

Are you on the latest chainladder version?

  • Yes, this bug occurs on the latest version.

Describe the bug in words

Some nonsense values can be passed to TrianglePandas.rename without triggering an exception. Instead, the method simply returns self if none of the conditional branches are triggered:

value = [value] if type(value) is str else value
        if axis == "index" or axis == 0:
            self.index = value
        if axis == "columns" or axis == 1:
            self.columns = value
        if axis == "origin" or axis == 2:
            self.origin = value
        if axis == "development" or axis == 3:
            self.development = value
        return self

Users may end up believing that something was renamed, when instead nothing actually happened.

How can the bug be reproduced?

The following is an example where the user mistypes "columns" as "colunms".

genins = cl.load_sample('genins')
genins.rename('colunms', 'bar')

What is the expected behavior?

A ValueError should be triggered, notifying the user that an invalid value was passed to the axis argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Effort > Brief 🐇Small tasks expected to take a few hours up to a couple of days.Great First Contribution! 🌱Beginner friendly tickets with narrow scope and huge impact. Perfect to join our community!Impact > Minor 🔷Small, backward compatible change. Treat like a patch release (e.g., 0.5.8 → 0.5.9).Triage Pending ⚠️New issues that haven't yet been reviewed or categorized.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions