Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong claims values after 24 development periods [BUG] #438

Closed
andrejakobsen opened this issue Jun 15, 2023 · 3 comments
Closed

Wrong claims values after 24 development periods [BUG] #438

andrejakobsen opened this issue Jun 15, 2023 · 3 comments
Assignees
Labels

Comments

@andrejakobsen
Copy link
Contributor

andrejakobsen commented Jun 15, 2023

Describe the bug
While using the package on monthly data, I noticed that the second origin row was missing claims values for the last development period. It looked like one value was missing and the rest got offset. Upon closer inspection, the 25th development period gets set equal to the sum of the values at development periods 23 and 25, where 25 gets the value of 26 and 27 gets the value at 28, etc. So after 24 development periods the values are offset by 1 period. This also occurs for the first origin period but at development period 25. However, all origin periods after the second do not seem to have this issue.

To Reproduce
Steps to reproduce the behavior. Code should be self-contained and runnable against publicly available data. Here is a test file that makes it easy to see the issue: test_triangle.csv

import chainladder as cl
import pandas as pd
test_triangle = pd.read_csv("test_triangle.csv")
triangle = cl.Triangle(
    test_triangle,
    origin="origin",
    eevelopment="development",
    columns="claims",
    cumulative=True
)

Expected behavior
A clear and concise description of what you expected to happen. If it can be expressed in code, then that is better. The complete code can serve as a unit test.

assert triangle.loc[..., "claims", "2018-01", 25] == 25

Desktop (please complete the following information):

  • Numpy 1.24.3
  • Pandas 2.0.2
  • Chainladder 0.8.15
@jbogaardt
Copy link
Collaborator

Thanks, I haven't yet run our test suite against pandas>=2.0. Sounds like there are breaking changes that need to be addressed. This issue gives me a good place to start looking.

@kennethshsu
Copy link
Collaborator

@andrejakobsen welcome!

I've been trying to figure out what's going on, but as a temporary solution, you can do something like

.dev_to_val().val_to_dev()

This will at least gets you back to the correct age periods. Will continue to investigate later today...

@andrejakobsen
Copy link
Contributor Author

Thanks, I haven't yet run our test suite against pandas>=2.0. Sounds like there are breaking changes that need to be addressed. This issue gives me a good place to start looking.

I was suspecting it might be related to pandas 2.0 since I haven't had any issues before. Glad to have it confirmed 👍🏻 Should I make a PR for requirements.txt to have pandas>=0.23,<2.0.0 for the time being?

Thanks for the tip, @kennethshsu! I will probably just stick to an earlier version of pandas for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants