Skip to content

[BUG] Bug in __le__ dunder #1392

Description

@genedan

Are you on the latest chainladder version?

  • Yes, this bug occurs on the latest version.

Describe the bug in words

The __le__ (less than or equal to) dunder is a copy of __lt__ (less than)

How can the bug be reproduced?

Consider the following example:

import chainladder as cl
raa = cl.load_sample('raa')

raa

         12       24       36       48       60       72       84       96       108      120
1981  5012.0   8269.0  10907.0  11805.0  13539.0  16181.0  18009.0  18608.0  18662.0  18834.0
1982   106.0   4285.0   5396.0  10666.0  13782.0  15599.0  15496.0  16169.0  16704.0      NaN
1983  3410.0   8992.0  13873.0  16141.0  18735.0  22214.0  22863.0  23466.0      NaN      NaN
1984  5655.0  11555.0  15766.0  21266.0  23425.0  26083.0  27067.0      NaN      NaN      NaN
1985  1092.0   9565.0  15836.0  22169.0  25955.0  26180.0      NaN      NaN      NaN      NaN
1986  1513.0   6445.0  11702.0  12935.0  15852.0      NaN      NaN      NaN      NaN      NaN
1987   557.0   4020.0  10946.0  12314.0      NaN      NaN      NaN      NaN      NaN      NaN
1988  1351.0   6947.0  13112.0      NaN      NaN      NaN      NaN      NaN      NaN      NaN
1989  3133.0   5395.0      NaN      NaN      NaN      NaN      NaN      NaN      NaN      NaN
1990  2063.0      NaN      NaN      NaN      NaN      NaN      NaN      NaN      NaN      NaN

Pay attention to what happens to the 5012.0 value in the top left cell:

raa <= 5012.0

        12     24     36     48     60     72     84     96     108    120
1981  False  False  False  False  False  False  False  False  False  False
1982   True   True  False  False  False  False  False  False  False   True
1983   True  False  False  False  False  False  False  False   True   True
1984  False  False  False  False  False  False  False   True   True   True
1985   True  False  False  False  False  False   True   True   True   True
1986   True  False  False  False  False   True   True   True   True   True
1987   True   True  False  False   True   True   True   True   True   True
1988   True  False  False   True   True   True   True   True   True   True
1989   True  False   True   True   True   True   True   True   True   True
1990   True   True   True   True   True   True   True   True   True   True

What is the expected behavior?

The upper-left cell should have been True instead of False.

Would you be willing to contribute this ticket?

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Great First Contribution! 🌱Beginner friendly tickets with narrow scope and huge impact. Perfect to get your feet wet!

    Type

    Fields

    Priority

    High

    Effort

    Low

    Scope

    Codebase

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions