diff --git a/chainladder/core/tests/test_triangle.py b/chainladder/core/tests/test_triangle.py index 58d468fc..96670638 100644 --- a/chainladder/core/tests/test_triangle.py +++ b/chainladder/core/tests/test_triangle.py @@ -641,3 +641,9 @@ def test_loc_ellipsis(): assert tri.loc[:, ..., 24:] == tri.loc[..., :, 24:] assert tri.loc[:, "CumPaidLoss"] == tri.loc[:, "CumPaidLoss", ...] assert tri.loc[..., "CumPaidLoss", :, :] == tri.loc[:, "CumPaidLoss", :, :] + +def missing_first_lag(): + x = raa.copy() + x.values[:,:,:, 0] = 0 + x=x.sum(0) + x.link_ratio.shape == (1,1,9,9) diff --git a/chainladder/core/triangle.py b/chainladder/core/triangle.py index 57edbbd9..bd613b20 100644 --- a/chainladder/core/triangle.py +++ b/chainladder/core/triangle.py @@ -188,7 +188,8 @@ def latest_diagonal(self): @property def link_ratio(self): - obj = (self.iloc[..., 1:] / self.iloc[..., :-1].values).dropna() + obj = (self.iloc[..., 1:] / self.iloc[..., :-1].values) + obj = obj[obj.valuation<=obj.valuation_date] if hasattr(obj, "w_"): w_ = obj.w_[..., 0:1, : len(obj.odims), :] obj = obj * w_ if obj.shape == w_.shape else obj