Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
John Bogaardt committed Apr 10, 2024
1 parent eb8b303 commit 71a6ced
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion chainladder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ def auto_sparse(auto_sparse=True):
from chainladder.methods import * # noqa (API Import)
from chainladder.workflow import * # noqa (API Import)

__version__ = "0.8.19"
__version__ = "0.8.20"
6 changes: 2 additions & 4 deletions chainladder/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ def _set_development(data, development, development_format, origin_date):
development_date = TriangleBase._to_datetime(
data, development, period_end=True, format=development_format
)
# if np.all(development_date.dt.strftime('%m-%d') == '01-01'):
# development_date = pd.Series(pd.PeriodIndex(development_date, freq="Y").to_timestamp(how='e'))
else:
o_max = pd.Period(
origin_date.max(), freq=TriangleBase._get_grain(origin_date)
Expand Down Expand Up @@ -276,9 +274,9 @@ def _get_grain(dates, trailing=False, kind="origin"):
months = dates.dt.month.unique()
diffs = np.diff(np.sort(months))
if len(dates.unique()) == 1:
grain = "Y"
grain = "Y" if float('.'.join(pd.__version__.split('.')[:-1])) < 2.2 else "A"
elif len(months) == 1:
grain = "Y"
grain = "Y" if float('.'.join(pd.__version__.split('.')[:-1])) < 2.2 else "A"
elif np.all(diffs == 6):
grain = "2Q"
elif np.all(diffs == 3):
Expand Down
5 changes: 3 additions & 2 deletions chainladder/core/triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ def origin(self):
if self.is_pattern and len(self.odims) == 1:
return pd.Series(["(All)"])
else:
freq = {"Y": "Y", "S": "2Q", "H": "2Q"}.get(
freq = {"Y": "Y" if float('.'.join(pd.__version__.split('.')[:-1])) < 2.2 else "A",
"S": "2Q", "H": "2Q"}.get(
self.origin_grain, self.origin_grain
)
freq = freq if freq == "M" else freq + "-" + self.origin_close
Expand All @@ -339,7 +340,7 @@ def origin(self):
@origin.setter
def origin(self, value):
self._len_check(self.origin, value)
freq = {"Y": "Y", "S": "2Q"}.get(self.origin_grain, self.origin_grain)
freq = {"Y": "Y" if float('.'.join(pd.__version__.split('.')[:-1])) < 2.2 else "A", "S": "2Q"}.get(self.origin_grain, self.origin_grain)
freq = freq if freq == "M" else freq + "-" + self.origin_close
value = pd.PeriodIndex(list(value), freq=freq)
self.odims = value.to_timestamp().values
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
descr = "Chainladder Package - P&C Loss Reserving package "
name = 'chainladder'
url = 'https://github.com/casact/chainladder-python'
version='0.8.19' # Put this in __init__.py
version='0.8.20' # Put this in __init__.py

data_path = ''
setup(
Expand Down

0 comments on commit 71a6ced

Please sign in to comment.