From 0c1e1e091f7d286763b3175fc0fdcc7572c43561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20P=C3=B6lsterl?= Date: Thu, 1 Feb 2024 21:45:02 +0100 Subject: [PATCH] Fix deprecations with pandas 2.2 --- sksurv/column.py | 2 +- tests/test_column.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sksurv/column.py b/sksurv/column.py index 7e55847e..6086673d 100644 --- a/sksurv/column.py +++ b/sksurv/column.py @@ -199,7 +199,7 @@ def transform(column): except ValueError: classes = column.dropna().unique() classes.sort(kind="mergesort") - nc = column.replace(classes, np.arange(classes.shape[0], dtype=np.int64)) + nc = column.map(dict(zip(classes, range(classes.shape[0])))) return nc if column.dtype == bool: return column.astype(np.int64) diff --git a/tests/test_column.py b/tests/test_column.py index 1c4cc728..3f8aabd0 100644 --- a/tests/test_column.py +++ b/tests/test_column.py @@ -42,7 +42,7 @@ def non_numeric_data(self): } ) - data.loc[:, "q3"] = data.loc[:, "q3"].astype("category") + data["q3"] = data.loc[:, "q3"].astype("category") return data def data_numeric(self):