Skip to content

Triangle.pct_chg() always raises AttributeError #1528

Open

Description

@yuuuxt

Are you on the latest chainladder version?

  • Yes, this bug occurs on the latest version.

Describe the bug in words

pct_chg is in the df_passthru list in chainladder/core/pandas.py, so Triangle.pct_chg is created as a call to pd.DataFrame.pct_chg. pandas has no such method; the pandas method is pct_change. Every call fails at runtime. The user guide (docs/user_guide/triangle.ipynb) also lists pct_chg as a supported pass-through.

How can the bug be reproduced?

import chainladder as cl

raa = cl.load_sample("raa")
raa.pct_chg()

# AttributeError: type object 'DataFrame' has no attribute 'pct_chg'. Did you mean: 'pct_change'?

What is the expected behavior?

Triangle.pct_change() should work and match pandas.DataFrame.pct_change on to_frame(). To stay backward compatible, pct_chg could either be kept as a deprecated alias or removed. The user guide table should be updated to match.

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

    Type

    No type

    Fields

    Priority

    None yet

    Scope

    None yet

    Effort

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions