Fix error in survtime_to_numeric when applied to 1D data

This commit is contained in:
RunasSudo 2023-12-31 18:33:44 +11:00
parent f2987bfd2d
commit 00ed38d47d
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -331,7 +331,7 @@ def survtime_to_numeric(df, time, time2=None):
df[time] = df[time].dt.total_seconds() df[time] = df[time].dt.total_seconds()
max_time = df[time].max() max_time = df[time].max()
if df[time2].dtype == '<m8[ns]': if time2 and df[time2].dtype == '<m8[ns]':
df[time2] = df[time2].dt.total_seconds() df[time2] = df[time2].dt.total_seconds()
max_time = max(max_time or 0, df[time2].max()) max_time = max(max_time or 0, df[time2].max())