Skip to content

Commit 04ccad9

Browse files
address pandas deprecation warning
``` .../lib/python3.10/site-packages/lifelines/fitters/cox_time_varying_fitter.py:819: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '0.6058777002252564' has dtype incompatible with int64, please explicitly cast to a compatible dtype first. ``` this warning goes away with this change. `pandas==2.1.4`
1 parent 2bd0627 commit 04ccad9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lifelines/fitters/cox_time_varying_fitter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def _compute_cumulative_baseline_hazard(self, tv_data, events, start, stop, weig
801801
hazards = self.predict_partial_hazard(tv_data).values
802802

803803
unique_death_times = np.unique(stop[events.values])
804-
baseline_hazard_ = pd.DataFrame(np.zeros_like(unique_death_times), index=unique_death_times, columns=["baseline hazard"])
804+
baseline_hazard_ = pd.DataFrame(np.zeros_like(unique_death_times).astype(float), index=unique_death_times, columns=["baseline hazard"])
805805

806806
for t in unique_death_times:
807807
ix = (start.values < t) & (t <= stop.values)

0 commit comments

Comments
 (0)