Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions chainladder/utils/data/_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
Measure column name(s) loaded into the Triangle.
``cumulative``
``True`` if the measures are cumulative, ``False`` if incremental.
``development_format``
Optional. Passed to ``Triangle`` by :func:`chainladder.load_sample`.
"""

SAMPLES: dict = {
Expand Down Expand Up @@ -157,6 +159,7 @@
"Paid Claims",
],
"cumulative": True,
"development_format": "%Y-12-31",
},
"friedland_med_mal": {
"origin": "Accident Year",
Expand Down
17 changes: 7 additions & 10 deletions chainladder/utils/utility_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import numpy as np
import pandas as pd

from chainladder import (
__dt64_unit__,
__dt64_dtype__
)
from chainladder import __dt64_unit__, __dt64_dtype__
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

someone's linter at it again

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man I hate this... We basically have a competing linter...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@genedan @henrydingliu what linter are you using? Can we just use the same one? x.x

Are you all on ruff?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

black. but i rarely turn it on

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using black too, and mine is apply on save lol

from chainladder.utils.sparse import sp
from chainladder.utils.data._manifest import SAMPLES
from io import StringIO
Expand Down Expand Up @@ -117,6 +114,8 @@ def load_sample(key: str, *args, **kwargs) -> Triangle:
columns = config["columns"]
cumulative = config["cumulative"]

development_format = config.get("development_format", None)

df = pd.read_csv(filepath_or_buffer=dataset_path)

return Triangle(
Expand All @@ -126,6 +125,7 @@ def load_sample(key: str, *args, **kwargs) -> Triangle:
index=index,
columns=columns,
cumulative=cumulative,
development_format=development_format,
*args,
**kwargs,
)
Expand Down Expand Up @@ -818,6 +818,7 @@ def PTF_formula(
return "+".join(formula_parts)
return ""


def date_delta_adjustment(date: str) -> str:
"""
Subtracts the default pandas datetime delta from a date in "YYYY-MM-DD" string format.
Expand Down Expand Up @@ -855,10 +856,6 @@ def date_delta_adjustment(date: str) -> str:
'2025-10-31 23:59:59.999999'
"""

res: str = str(pd.Timestamp(date) - pd.Timedelta(1, unit=__dt64_unit__))

res: str = str(
pd.Timestamp(date) - \
pd.Timedelta(1, unit=__dt64_unit__)
)

return res
return res
Loading