Skip to content

Add level parameter to Triangle.drop() #1061

Description

@genedan

Description

In the case of a Triangle with a multi-level index, level can be used to drop a specific level of the index via Triangle.drop().

Is your feature request aligned with the scope of the package?

  • Yes, absolutely!
  • No, but it's still worth discussing.
  • N/A (this request is not a codebase enhancement).

Describe the solution you'd like, or your current workaround.

tri = cl.Triangle(
    data={
        'origin': [1985, 1985, 1985, 1986, 1986, 1987] * 4,
        'development': [1985, 1986, 1987, 1986, 1987, 1987] * 4,
        'paid': [300, 400, 500, 500, 600, 500] * 4,
        'company': ['ballstate', 'regressive'] * 12,
        'lob': (['auto'] * 6 + ['wkcomp'] * 6) * 2
    },
    origin='origin',
    development='development',
    columns=['paid'],
    index=['company', 'lob'],
    cumulative=True
)
print(tri.index)

      company     lob
0   ballstate    auto
1   ballstate  wkcomp
2  regressive    auto
3  regressive  wkcomp
print(tri.drop(index='wkcomp', level=1))

      company     lob
0   ballstate    auto
1  regressive    auto

Do you have any additional supporting notes?

No response

Would you be willing to contribute this ticket?

  • Yes, absolutely!
  • Yes, but I would like some help.
  • No.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    Priority

    Low

    Effort

    Medium

    Scope

    Codebase

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions