Skip to content

Commit

Permalink
use rename_categories
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelvallat committed Dec 22, 2024
1 parent 33954f4 commit 74c7c53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion yasa/hypno.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def as_int(self):
Name: Stage, dtype: int16
"""
# Return as int16 (-32768 to 32767) to reduce memory usage
return self.hypno.map(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.
Expand Down

0 comments on commit 74c7c53

Please sign in to comment.