diff --git a/yasa/hypno.py b/yasa/hypno.py index 980c11e..4789eb1 100644 --- a/yasa/hypno.py +++ b/yasa/hypno.py @@ -482,7 +482,7 @@ def as_int(self): Name: Stage, dtype: int16 """ # Return as int16 (-32768 to 32767) to reduce memory usage - return self.hypno.replace(self.mapping).astype(np.int16) + return self.hypno.cat.rename_categories(self.mapping).astype(np.int16) def consolidate_stages(self, new_n_stages): """Reduce the number of stages in a hypnogram to match actigraphy or wearables.