Skip to content

Commit cca5288

Browse files
Merge pull request #1453 from CamDavidsonPilon/v0.27.2
0.27.2
2 parents f156b7f + 3d9f269 commit cca5288

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
## Changelog
22

3-
#### 0.27.1 - 2022-03-15
3+
#### 0.27.2 - 2022-09-07
4+
5+
##### Bug fixes
6+
- Fixed issue in add_at_risk_table when there were very late entries.
7+
8+
9+
#### 0.27.1 - 2022-06-25
410

511
##### New features
612
- all `fit_` methods now accept a `fit_options` dict that allows one to pass kwargs to the underlying fitting algorithm.
@@ -10,7 +16,7 @@
1016
- `step_size` is removed from Cox models `fit`. See `fit_options` above.
1117

1218
##### Bug fixes
13-
- fixed Cox models when "trival" matrix was passed in (one with no covariates)
19+
- fixed Cox models when "trivial" matrix was passed in (one with no covariates)
1420

1521
#### 0.27.0 - 2022-03-15
1622

lifelines/fitters/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,9 +1278,7 @@ def _compute_central_values_of_raw_training_data(self, df, strata=None, name="ba
12781278
return v
12791279

12801280
else:
1281-
from distutils.version import LooseVersion
1282-
1283-
if LooseVersion(pd.__version__) >= "1.1.0":
1281+
if pd.__version__ >= "1.1.0":
12841282
# silence deprecation warning
12851283
describe_kwarg = {"datetime_is_numeric": True}
12861284
else:

lifelines/fitters/coxph_fitter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ def _get_efron_values_single(
16211621
Calculates the first and second order vector differentials, with respect to beta.
16221622
Note that X, T, E are assumed to be sorted on T!
16231623
1624-
A good explanation for Efron. Consider three of five subjects who fail at the time.
1624+
A good explanation for Efron. Consider three of five subjects who fail at the same time.
16251625
As it is not known a priori that who is the first to fail, so one-third of
16261626
(φ1 + φ2 + φ3) is adjusted from sum_j^{5} φj after one fails. Similarly two-third
16271627
of (φ1 + φ2 + φ3) is adjusted after first two individuals fail, etc.

lifelines/plotting.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,16 @@ def add_at_risk_counts(
504504
else:
505505
event_table_slice = f.event_table.assign(at_risk=lambda x: x.at_risk - x.removed)
506506

507-
event_table_slice = (
508-
event_table_slice.loc[:tick, ["at_risk", "censored", "observed"]]
509-
.agg({"at_risk": lambda x: x.tail(1).values, "censored": "sum", "observed": "sum"}) # see #1385
510-
.rename({"at_risk": "At risk", "censored": "Censored", "observed": "Events"})
511-
)
512-
counts.extend([int(c) for c in event_table_slice.loc[rows_to_show]])
507+
if not event_table_slice.loc[:tick].empty:
508+
event_table_slice = (
509+
event_table_slice.loc[:tick, ["at_risk", "censored", "observed"]]
510+
.agg({"at_risk": lambda x: x.tail(1).values, "censored": "sum", "observed": "sum"}) # see #1385
511+
.rename({"at_risk": "At risk", "censored": "Censored", "observed": "Events"})
512+
.fillna(0)
513+
)
514+
counts.extend([int(c) for c in event_table_slice.loc[rows_to_show]])
515+
else:
516+
counts.extend([0 for _ in range(n_rows)])
513517

514518
if n_rows > 1:
515519
if tick == ax2.get_xticks()[0]:

lifelines/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import unicode_literals
33

4-
__version__ = "0.27.1"
4+
__version__ = "0.27.2"

0 commit comments

Comments
 (0)