Skip to content
Merged
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
8 changes: 7 additions & 1 deletion lifelines/fitters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,13 @@ def _compute_central_values_of_raw_training_data(self, df, strata=None, name="ba
return v

else:
described = df.describe(include="all")
from distutils.version import LooseVersion
if LooseVersion(pd.__version__) >= '1.1.0':
Copy link
Owner

Choose a reason for hiding this comment

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

TIL LooseVersion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One thing is that distutils will be deprecated in Python 3.9/3.10. Might make setuptools a runtime dependency at some point. Haven't been keeping up with this.

# silence deprecation warning
describe_kwarg = {'datetime_is_numeric': True}
else:
describe_kwarg = {}
described = df.describe(include="all", **describe_kwarg)
if "top" in described.index and "50%" not in described.index:
central_stats = described.loc["top"].copy()
elif "50%" in described.index and "top" not in described.index:
Expand Down